2.20 - more logging for easier debugging, optimizations...

This commit is contained in:
RandomNinjaAtk 2023-09-21 21:41:15 -04:00 committed by GitHub
parent 5d0b8c16d1
commit 69494df0b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
scriptVersion="2.19" scriptVersion="2.20"
scriptName="Audio" scriptName="Audio"
### Import Settings ### Import Settings
@ -1234,7 +1234,7 @@ SearchProcess () {
loopCount=0 loopCount=0
until false until false
do do
LidarrTaskStatusCheck
loopCount=$(( $loopCount + 1 )) loopCount=$(( $loopCount + 1 ))
if [ "$loopCount" == "1" ]; then if [ "$loopCount" == "1" ]; then
# First loop is either explicit or clean depending on script settings # First loop is either explicit or clean depending on script settings
@ -1259,11 +1259,11 @@ SearchProcess () {
lidarrAlbumReleaseTitleFirstWord="${lidarrAlbumReleaseTitleFirstWord:0:3}" lidarrAlbumReleaseTitleFirstWord="${lidarrAlbumReleaseTitleFirstWord:0:3}"
albumTitleSearch="$(jq -R -r @uri <<<"${lidarrAlbumReleaseTitleSearchClean}")" albumTitleSearch="$(jq -R -r @uri <<<"${lidarrAlbumReleaseTitleSearchClean}")"
#echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch" #echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch"
LidarrTaskStatusCheck
# Skip Various Artists album search that is not supported... # Skip Various Artists album search that is not supported...
if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then
# Lidarr Status Check
LidarrTaskStatusCheck #echo "1 : $lidarrDownloadImportNotfication"
# Tidal Artist search # Tidal Artist search
if [ "$lidarrDownloadImportNotfication" == "false" ]; then if [ "$lidarrDownloadImportNotfication" == "false" ]; then
@ -1275,6 +1275,8 @@ SearchProcess () {
fi fi
fi fi
#echo "2 : $lidarrDownloadImportNotfication"
# Deezer artist search # Deezer artist search
if [ "$lidarrDownloadImportNotfication" == "false" ]; then if [ "$lidarrDownloadImportNotfication" == "false" ]; then
if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "deezer" ]; then if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "deezer" ]; then
@ -1287,7 +1289,7 @@ SearchProcess () {
fi fi
fi fi
#echo "3 : $lidarrDownloadImportNotfication"
# Tidal fuzzy search # Tidal fuzzy search
if [ "$lidarrDownloadImportNotfication" == "false" ]; then if [ "$lidarrDownloadImportNotfication" == "false" ]; then
if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "tidal" ]; then if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "tidal" ]; then
@ -1296,6 +1298,7 @@ SearchProcess () {
fi fi
fi fi
#echo "4 : $lidarrDownloadImportNotfication"
# Deezer fuzzy search # Deezer fuzzy search
if [ "$lidarrDownloadImportNotfication" == "false" ]; then if [ "$lidarrDownloadImportNotfication" == "false" ]; then
if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "deezer" ]; then if [ "$dlClientSource" == "both" ] || [ "$dlClientSource" == "deezer" ]; then
@ -1319,6 +1322,16 @@ SearchProcess () {
# Break after all operations are complete # Break after all operations are complete
if [ "$loopCount" == "$endLoop" ]; then if [ "$loopCount" == "$endLoop" ]; then
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Album Not found"
if [ "$skipNotFoundLogCreation" == "false" ]; then
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Marking Album as notfound"
if [ ! -f "/config/extended/logs/notfound/$wantedAlbumId--$lidarrArtistForeignArtistId--$lidarrAlbumForeignAlbumId" ]; then
touch "/config/extended/logs/notfound/$wantedAlbumId--$lidarrArtistForeignArtistId--$lidarrAlbumForeignAlbumId"
chmod 777 "/config/extended/logs/notfound/$wantedAlbumId--$lidarrArtistForeignArtistId--$lidarrAlbumForeignAlbumId"
fi
else
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Skip marking album as not found because it's a new release for 7 days..."
fi
break break
fi fi
done done
@ -1395,8 +1408,10 @@ ArtistDeezerSearch () {
# String Character Count test, quicker than the levenshtein method to allow faster processing # String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..."
continue continue
elif [ "$characterMath" -lt "0" ]; then elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..."
continue continue
fi fi
GetDeezerAlbumInfo "$deezerAlbumID" GetDeezerAlbumInfo "$deezerAlbumID"
@ -1565,8 +1580,10 @@ ArtistTidalSearch () {
# String Character Count test, quicker than the levenshtein method to allow faster processing # String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue continue
elif [ "$characterMath" -lt "0" ]; then elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue continue
fi fi
@ -1626,8 +1643,10 @@ FuzzyTidalSearch () {
# String Character Count test, quicker than the levenshtein method to allow faster processing # String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue continue
elif [ "$characterMath" -lt "0" ]; then elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue continue
fi fi