From dd9211256ad9268407988cb8f10417a32c857c15 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Tue, 2 Jan 2024 10:38:41 +0000 Subject: [PATCH 01/23] Fix python errors... --- sonarr/setup.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonarr/setup.bash b/sonarr/setup.bash index 007cf67..cb5b767 100644 --- a/sonarr/setup.bash +++ b/sonarr/setup.bash @@ -16,7 +16,7 @@ apk add -U --update --no-cache \ ffmpeg \ yt-dlp echo "************ install python packages ************" -pip install --upgrade --no-cache-dir -U \ +pip install --upgrade --no-cache-dir -U --break-system-packages \ excludarr \ yq echo "************ setup SMA ************" @@ -32,8 +32,8 @@ echo "************ create logging file ************" mkdir -p /config/extended/sma/config touch /config/extended/sma/config/sma.log echo "************ install pip dependencies ************" -pip install --upgrade pip --no-cache-dir -pip install -r /config/extended/sma/setup/requirements.txt --no-cache-dir +pip install --upgrade pip --no-cache-dir --break-system-packages +pip install -r /config/extended/sma/setup/requirements.txt --no-cache-dir --break-system-packages chmod 777 -R /config/extended/sma echo "************ install recyclarr ************" mkdir -p /recyclarr From 3b686a549fc02d88aea5f8de6aa9cb81a45c4f06 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 4 Jan 2024 11:28:37 +0000 Subject: [PATCH 02/23] New autoArtistAdderMonitored setting #139 --- lidarr/extended.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/lidarr/extended.conf b/lidarr/extended.conf index 49157eb..a5bfac7 100644 --- a/lidarr/extended.conf +++ b/lidarr/extended.conf @@ -60,6 +60,7 @@ addDeezerTopTrackArtists="false" # true = enabled :: Enabling this will topLimit="3" # This setting controls the amount of Top Artist (Albums/Tracks/Artists) to add to Lidarr from Deezer addRelatedArtists="false" # true = enabled :: WARNING !!! WARNING !!! Enabling this can cause an endless loop of additional artists.... Enabling this will enable the extended script to automatically add artists that are related to your existing Lidarr artists from Tidal & Deezer numberOfRelatedArtistsToAddPerArtist="1" # 1-20 :: This will limit the number of related artists to add per artist in your library :: Minimum is 1, Maximum is 20 +autoArtistAdderMonitored="true" # true or false :: If true, artists that are added automatically are monitored, when false they are added in an unmonitored state ##### VIDEO SCRIPT addFeaturedVideoArtists="false" # true = enabled :: WARNING !!! WARNING !!! Enabling this can cause an endless loop of additional artists.... Enabling this will enable the extended Video script to automatically add Music Video Featured Artists to your existing Lidarr artists from IMVDB From 1cd883f7bfedeb1f4c4ea25f31cb10f447548ea0 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 4 Jan 2024 11:32:36 +0000 Subject: [PATCH 03/23] v2 - Use new autoArtistAdderMonitored setting #139 - Resolves this issue New setting allows users to enable/disable monitoring of artists when automatically added via script.. --- lidarr/AutoArtistAdder.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lidarr/AutoArtistAdder.bash b/lidarr/AutoArtistAdder.bash index 13162fd..0e8a0ab 100644 --- a/lidarr/AutoArtistAdder.bash +++ b/lidarr/AutoArtistAdder.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="1.9" +scriptVersion="2.0" scriptName="AutoArtistAdder" ### Import Settings @@ -21,6 +21,12 @@ verifyConfig () { autoArtistAdderInterval="12h" fi + if [ -z "$autoArtistAdderMonitored" ]; then + autoArtistAdderMonitored="true" + elif [ "$autoArtistAdderMonitored" != "true" ]; then + autoArtistAdderMonitored="false" + fi + } @@ -259,7 +265,7 @@ AddTidalArtistToLidarr () { \"foreignArtistId\": \"$foreignId\", \"qualityProfileId\": $qualityProfileId, \"metadataProfileId\": $metadataProfileId, - \"monitored\":true, + \"monitored\":$autoArtistAdderMonitored, \"monitor\":\"all\", \"rootFolderPath\": \"$path\", \"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing} From 8ae48c7941a46030bcf5be2f4962eb2dfe023302 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 4 Jan 2024 11:35:44 +0000 Subject: [PATCH 04/23] v2.1 - Missed a spot... for autoArtistAdderMonitored #139 --- lidarr/AutoArtistAdder.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lidarr/AutoArtistAdder.bash b/lidarr/AutoArtistAdder.bash index 0e8a0ab..85fe9d8 100644 --- a/lidarr/AutoArtistAdder.bash +++ b/lidarr/AutoArtistAdder.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.0" +scriptVersion="2.1" scriptName="AutoArtistAdder" ### Import Settings @@ -114,7 +114,7 @@ AddDeezerArtistToLidarr () { \"foreignArtistId\": \"$foreignId\", \"qualityProfileId\": $qualityProfileId, \"metadataProfileId\": $metadataProfileId, - \"monitored\":true, + \"monitored\":$autoArtistAdderMonitored, \"monitor\":\"all\", \"rootFolderPath\": \"$path\", \"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing} From b8f674e138b4ce3f60dd4b462410c450384a9d98 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 11:12:41 +0000 Subject: [PATCH 05/23] 2.25 - Truncate downloaded folder name #156 - Only use first 100 characters of album name in folder name... --- lidarr/Audio.service.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index b23ca2f..733da79 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.24" +scriptVersion="2.25" scriptName="Audio" ### Import Settings @@ -665,7 +665,7 @@ DownloadProcess () { fi albumquality="$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | head -n 1 | egrep -i -E -o "\.{1}\w*$" | sed 's/\.//g')" - downloadedAlbumFolder="$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-${albumquality^^}-$1-$2" + downloadedAlbumFolder="$lidarrArtistNameSanitized-${downloadedAlbumTitleClean:0:100} ($3)-${albumquality^^}-$1-$2" find "$audioPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do file="${audio}" From 4fba19499df709e4b49f412efff3b06f44b1620b Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 11:25:50 +0000 Subject: [PATCH 06/23] v2.26 - Truncate Album Names #156 - Limit names to 130 characters --- lidarr/Audio.service.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 733da79..669ca61 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.25" +scriptVersion="2.26" scriptName="Audio" ### Import Settings @@ -1265,6 +1265,7 @@ SearchProcess () { releaseProcessCount=$(( $releaseProcessCount + 1)) lidarrReleaseTitle="${lidarrReleaseTitles[$title]}" lidarrAlbumReleaseTitleClean=$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g') + lidarrAlbumReleaseTitleClean="${lidarrAlbumReleaseTitleClean:0:130}" lidarrAlbumReleaseTitleSearchClean="$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" lidarrAlbumReleaseTitleFirstWord="$(echo "$lidarrReleaseTitle" | awk '{ print $1 }')" lidarrAlbumReleaseTitleFirstWord="${lidarrAlbumReleaseTitleFirstWord:0:3}" @@ -1414,6 +1415,7 @@ ArtistDeezerSearch () { deezerAlbumData="$(echo "$deezerArtistAlbumsData" | jq -r "select(.id==$deezerAlbumID)")" deezerAlbumTitle="$(echo "$deezerAlbumData" | jq -r ".title")" deezerAlbumTitleClean="$(echo ${deezerAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" + deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}" # String Character Count test, quicker than the levenshtein method to allow faster processing characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) if [ "$characterMath" -gt "$matchDistance" ]; then @@ -1427,8 +1429,6 @@ ArtistDeezerSearch () { deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")" deezerAlbumTrackCount="$(echo "$deezerAlbumData" | jq -r .nb_tracks)" deezerAlbumExplicitLyrics="$(echo "$deezerAlbumData" | jq -r .explicit_lyrics)" - deezerAlbumTitle="$(echo "$deezerAlbumData"| jq -r .title)" - deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" downloadedReleaseDate="$(echo "$deezerAlbumData" | jq -r .release_date)" downloadedReleaseYear="${downloadedReleaseDate:0:4}" @@ -1494,7 +1494,7 @@ FuzzyDeezerSearch () { deezerAlbumTitle="$(echo "$deezerAlbumData" | jq -r ".title")" deezerAlbumTitle="$(echo "$deezerAlbumTitle" | head -n1)" deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" - + deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}" # String Character Count test, quicker than the levenshtein method to allow faster processing characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) if [ "$characterMath" -gt "$matchDistance" ]; then @@ -1507,8 +1507,6 @@ FuzzyDeezerSearch () { deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")" deezerAlbumTrackCount="$(echo "$deezerAlbumData" | jq -r .nb_tracks)" deezerAlbumExplicitLyrics="$(echo "$deezerAlbumData" | jq -r .explicit_lyrics)" - deezerAlbumTitle="$(echo "$deezerAlbumData"| jq -r .title)" - deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" downloadedReleaseDate="$(echo "$deezerAlbumData" | jq -r .release_date)" downloadedReleaseYear="${downloadedReleaseDate:0:4}" @@ -1588,6 +1586,7 @@ ArtistTidalSearch () { tidalArtistAlbumData=$(echo "$tidalArtistAlbumsData" | jq -r "select(.id=="$tidalArtistAlbumId")") downloadedAlbumTitle="$(echo ${tidalArtistAlbumData} | jq -r .title)" tidalAlbumTitleClean=$(echo ${downloadedAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g') + tidalAlbumTitleClean="${tidalAlbumTitleClean:0:130}" downloadedReleaseDate="$(echo ${tidalArtistAlbumData} | jq -r .releaseDate)" if [ "$downloadedReleaseDate" == "null" ]; then downloadedReleaseDate=$(echo $tidalArtistAlbumData | jq -r '.streamStartDate') @@ -1655,6 +1654,7 @@ FuzzyTidalSearch () { tidalAlbumData="$(echo "$tidalSearch" | jq -r "select(.id==$tidalAlbumID)")" tidalAlbumTitle=$(echo "$tidalAlbumData"| jq -r .title) tidalAlbumTitleClean=$(echo ${tidalAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g') + tidalAlbumTitleClean="${tidalAlbumTitleClean:0:130}" downloadedReleaseDate="$(echo ${tidalAlbumData} | jq -r .releaseDate)" if [ "$downloadedReleaseDate" == "null" ]; then downloadedReleaseDate=$(echo $tidalAlbumData | jq -r '.streamStartDate') From ebd5eb775797f6562dc177f65c331ac912133a37 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 18:32:47 +0000 Subject: [PATCH 07/23] v2.27 - New ignoreInstrumentalRelease option #159 - Settting ignoreInstrumentalRelease to true in the config will cause the script to skip any release that has the word "Instrumental" in the title or disambiguation... This is untested, but should work.... --- lidarr/Audio.service.bash | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 669ca61..9a2961d 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.26" +scriptVersion="2.27" scriptName="Audio" ### Import Settings @@ -35,6 +35,10 @@ verifyConfig () { deezerClientTestDownloadId="197472472" fi + if [ -z "$ignoreInstrumentalRelease" ]; then + ignoreInstrumentalRelease="false" + fi + audioPath="$downloadPath/audio" } @@ -1272,6 +1276,15 @@ SearchProcess () { albumTitleSearch="$(jq -R -r @uri <<<"${lidarrAlbumReleaseTitleSearchClean}")" #echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch" + + # ignore instrumental releases + if [ "$ignoreInstrumentalRelease" == "true" ]; then + if echo "$lidarrReleaseTitle" | grep -i "instrumental" | read; then + log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Instrumental Release Found, Skipping..." + continue + fi + fi + # Skip Various Artists album search that is not supported... if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then From df1b9eb8468236424de853df9ea6376f16ad7a02 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 18:34:22 +0000 Subject: [PATCH 08/23] Add ignoreInstrumentalRelease #159 --- lidarr/extended.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lidarr/extended.conf b/lidarr/extended.conf index a5bfac7..ae40e55 100644 --- a/lidarr/extended.conf +++ b/lidarr/extended.conf @@ -29,10 +29,11 @@ configureTrackNamingSettings="true" ##### AUDIO SCRIPT # SEARCH -searchSort="date" # date or album :: Sorts the missing/cutoff list by release date (newest -> oldest) or album type (album -> single) for processing the list -matchDistance="5" # The number of changes required to transform the searched album title into a possible found album title match... (0, requires a perfect match) -lidarrSearchForMissing="true" # true = enabled :: When artists are added, search for them using Lidarr's built in functionality -retryNotFound="90" ## :: Number of days between re-attempting the download of previously notfound albums +searchSort="date" # date or album :: Sorts the missing/cutoff list by release date (newest -> oldest) or album type (album -> single) for processing the list +matchDistance="5" # The number of changes required to transform the searched album title into a possible found album title match... (0, requires a perfect match) +lidarrSearchForMissing="true" # true = enabled :: When artists are added, search for them using Lidarr's built in functionality +retryNotFound="90" ## :: Number of days between re-attempting the download of previously notfound albums +ignoreInstrumentalRelease="false" # true = enabled :: Skips albums releases that have the word "instrumental" in either the title or disambiguation # CLIENT dlClientSource="deezer" # deezer, tidal or both :: set to both, to use both clients, tidal requires extra steps, view logging output From 1487dd7837bcf1ab77147a8a74ef1097cd00089a Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 15:15:36 -0500 Subject: [PATCH 09/23] 2.28 - Only ignore instrumental releases by disambiguation, not release group, enable by default #159 - Further improvements... By default if not configured, ignore instrumental releases. However, the script will never ignore release groups that contain Instrumental in the album name/title. This will allow you to download instrumental releases when it happens to be in the main release group title and ignore it when it just happens to be a alternate version of a particular album/release group (disambiguation) --- lidarr/Audio.service.bash | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 9a2961d..79ed1e8 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.27" +scriptVersion="2.28" scriptName="Audio" ### Import Settings @@ -36,7 +36,7 @@ verifyConfig () { fi if [ -z "$ignoreInstrumentalRelease" ]; then - ignoreInstrumentalRelease="false" + ignoreInstrumentalRelease="true" fi audioPath="$downloadPath/audio" @@ -1277,13 +1277,17 @@ SearchProcess () { #echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch" - # ignore instrumental releases - if [ "$ignoreInstrumentalRelease" == "true" ]; then - if echo "$lidarrReleaseTitle" | grep -i "instrumental" | read; then - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Instrumental Release Found, Skipping..." - continue - fi - fi + if "$lidarrAlbumTitle" | grep -i "instrumental" | read; then + sleep 0.01 + else + # ignore instrumental releases + if [ "$ignoreInstrumentalRelease" == "true" ]; then + if echo "$lidarrReleaseTitle" | grep -i "instrumental" | read; then + log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Instrumental Release Found, Skipping..." + continue + fi + fi + fi # Skip Various Artists album search that is not supported... if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then From 1082051a193ad4502c263188048c53ea196fceda Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 15:19:53 -0500 Subject: [PATCH 10/23] v2.29 - bug fix, missing echo command #159 --- lidarr/Audio.service.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 79ed1e8..5d8a788 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.28" +scriptVersion="2.29" scriptName="Audio" ### Import Settings @@ -1277,7 +1277,7 @@ SearchProcess () { #echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch" - if "$lidarrAlbumTitle" | grep -i "instrumental" | read; then + if echo "$lidarrAlbumTitle" | grep -i "instrumental" | read; then sleep 0.01 else # ignore instrumental releases From 80c385308108678076ea3d989432830d7fb38038 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 11 Jan 2024 15:39:52 -0500 Subject: [PATCH 11/23] 2.30 - Remove duplicate entries in temporary release title list... --- lidarr/Audio.service.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 5d8a788..3dfe7af 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.29" +scriptVersion="2.30" scriptName="Audio" ### Import Settings @@ -1236,8 +1236,8 @@ SearchProcess () { releaseDisambiguation=" ($releaseDisambiguation)" fi echo "${releaseTitle}${releaseDisambiguation}" >> /temp-release-list - echo "$lidarrAlbumTitle" >> /temp-release-list done + echo "$lidarrAlbumTitle" >> /temp-release-list # Get Release Titles OLDIFS="$IFS" From 33959af52a00ec0fd0c7cebe759075e72b0bc599 Mon Sep 17 00:00:00 2001 From: ngInit <38122413+ngInit@users.noreply.github.com> Date: Thu, 11 Jan 2024 23:56:49 -0700 Subject: [PATCH 12/23] Update Video.service.bash null check added to $videoContainer --- lidarr/Video.service.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lidarr/Video.service.bash b/lidarr/Video.service.bash index eb4de4c..845b836 100644 --- a/lidarr/Video.service.bash +++ b/lidarr/Video.service.bash @@ -8,7 +8,9 @@ source /config/extended.conf source /config/extended/functions verifyConfig () { - videoContainer=mkv + if [ -z "$videoContainer" ]; then + videoContainer="mkv" + fi if [ "$enableVideo" != "true" ]; then log "Script is not enabled, enable by setting enableVideo to \"true\" by modifying the \"/config/extended.conf\" config file..." From 223f96987a6e75bf24b47ea9264aeb087f442b60 Mon Sep 17 00:00:00 2001 From: zimmra Date: Tue, 16 Jan 2024 18:28:34 -0800 Subject: [PATCH 13/23] Modify sed to only remove first `/` Removes global sed flag so that only the first `/` is removed from the arrUrlBase config parameter. Fixes https://github.com/RandomNinjaAtk/arr-scripts/issues/165 --- universal/functions.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/universal/functions.bash b/universal/functions.bash index 1203506..6fce1d4 100644 --- a/universal/functions.bash +++ b/universal/functions.bash @@ -22,7 +22,7 @@ getArrAppInfo () { if [ "$arrUrlBase" == "null" ]; then arrUrlBase="" else - arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")" + arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///")" fi arrName="$(cat /config/config.xml | xq | jq -r .Config.InstanceName)" arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)" From 1d9bbcd5f34dab12ccb680158cf5d6cc22a7ef69 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sat, 27 Jan 2024 16:36:23 -0500 Subject: [PATCH 14/23] v1.6 - Allow only 1 M4b and 1 MP3 file --- sabnzbd/audiobook.bash | 91 +++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/sabnzbd/audiobook.bash b/sabnzbd/audiobook.bash index 75a43b5..4084733 100644 --- a/sabnzbd/audiobook.bash +++ b/sabnzbd/audiobook.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -ScriptVersion="1.5" +ScriptVersion="1.6" scriptName="Audiobook" #### Import Settings @@ -15,7 +15,7 @@ if [ -z $allowM4b ]; then fi if [ -z $allowMp3 ]; then - allowMp3=false + allowMp3=true fi set -e @@ -29,54 +29,65 @@ SECONDS=0 log "Processing $1" log "Searching for audiobook (m4b) files in completed download..." m4bCount=$(find "$1" -type f -iname "*.m4b" | wc -l) -if [ $m4bCount -gt 0 ]; then - log "$m4bCount M4B files found, removing non m4b files..." - find "$1" -type f -not -iname "*.m4b" -delete - find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; - find "$1" -mindepth 1 -type d -delete +if [ $m4bCount -ne 1 ]; then + log "ERROR: More than 1 M4B file found, performing cleanup..." + find "$1" -type f -iname "m4b" -delete else - log "None found..." -fi + if [ $m4bCount -gt 0 ]; then + log "$m4bCount M4B files found, removing non m4b files..." + find "$1" -type f -not -iname "*.m4b" -delete + find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; + find "$1" -mindepth 1 -type d -delete + else + log "None found..." + fi + fi log "Searching for audiobook (m4b.mp4) files in completed download..." mp4Count=$(find "$1" -type f -iname "*.m4b.mp4" | wc -l) -if [ $mp4Count -gt 0 ]; then - log "$mp4Count M4B (m4b.mp4) files found, removing non m4b files..." - find "$1" -type f -not -iname "*.m4b.mp4" -delete - find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; - find "$1" -mindepth 1 -type d -delete - log "Renaming m4b.mp4 files to m4b..." - count=0 - fileCount=$(find "$1" -type f -iname "*.m4b.mp4"| wc -l) - find "$1" -type f -iname "*.m4b.mp4" -print0 | while IFS= read -r -d '' file; do - count=$(($count+1)) - baseFileName="${file%.*}" - fileName="$(basename "$file")" - extension="${fileName##*.}" - log "$count of $fileCount :: Processing $fileName" - if [ -f "$file" ]; then - mv "$file" "$1/${fileName%.*}" - fi - done - log "All files renamed" +if [ $mp4Count -ne 1 ]; then + log "ERROR: More than 1 MP4 file found, performing cleanup..." + find "$1" -type f -iname "*.mp4" -delete else - log "None found..." + if [ $mp4Count -gt 0 ]; then + log "$mp4Count M4B (m4b.mp4) files found, removing non m4b files..." + find "$1" -type f -not -iname "*.m4b.mp4" -delete + find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; + find "$1" -mindepth 1 -type d -delete + log "Renaming m4b.mp4 files to m4b..." + count=0 + fileCount=$(find "$1" -type f -iname "*.m4b.mp4"| wc -l) + find "$1" -type f -iname "*.m4b.mp4" -print0 | while IFS= read -r -d '' file; do + count=$(($count+1)) + baseFileName="${file%.*}" + fileName="$(basename "$file")" + extension="${fileName##*.}" + log "$count of $fileCount :: Processing $fileName" + if [ -f "$file" ]; then + mv "$file" "$1/${fileName%.*}" + fi + done + log "All files renamed" + else + log "None found..." + fi fi log "Searching for audiobook (mp3) files in completed download..." mp3Count=$(find "$1" -type f -iname "*.mp3" | wc -l) -if [ $mp3Count -gt 0 ]; then - log "$mp3Count MP3 files found, removing non mp3 files..." - find "$1" -type f -not -iname "*.mp3" -delete - find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; - find "$1" -mindepth 1 -type d -delete - if [ $mp3Count -ne 1 ]; then - log "ERROR: More than 1 MP3 file found, performing cleanup..." - find "$1" -type f -iname "*.mp3" -delete - fi +if [ $mp3Count -ne 1 ]; then + log "ERROR: More than 1 MP3 file found, performing cleanup..." + find "$1" -type f -iname "*.mp3" -delete else - log "None found..." -fi + if [ $mp3Count -gt 0 ]; then + log "$mp3Count MP3 files found, removing non mp3 files..." + find "$1" -type f -not -iname "*.mp3" -delete + find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \; + find "$1" -mindepth 1 -type d -delete + else + log "None found..." + fi + fi error="false" bookfound="false" From e323b8a091af7a945df187ff5dfa4fd9fcbd4be1 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sat, 27 Jan 2024 16:41:00 -0500 Subject: [PATCH 15/23] v1.7 - Improved logging output --- sabnzbd/audiobook.bash | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sabnzbd/audiobook.bash b/sabnzbd/audiobook.bash index 4084733..ef08ca0 100644 --- a/sabnzbd/audiobook.bash +++ b/sabnzbd/audiobook.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -ScriptVersion="1.6" +ScriptVersion="1.7" scriptName="Audiobook" #### Import Settings @@ -27,12 +27,12 @@ exec &> >(tee -a "/config/scripts/audiobook.txt") SECONDS=0 log "Processing $1" -log "Searching for audiobook (m4b) files in completed download..." m4bCount=$(find "$1" -type f -iname "*.m4b" | wc -l) -if [ $m4bCount -ne 1 ]; then +if [ $m4bCount -gt 1 ]; then log "ERROR: More than 1 M4B file found, performing cleanup..." find "$1" -type f -iname "m4b" -delete else + log "Searching for audiobook (m4b) files in completed download..." if [ $m4bCount -gt 0 ]; then log "$m4bCount M4B files found, removing non m4b files..." find "$1" -type f -not -iname "*.m4b" -delete @@ -43,12 +43,12 @@ else fi fi -log "Searching for audiobook (m4b.mp4) files in completed download..." mp4Count=$(find "$1" -type f -iname "*.m4b.mp4" | wc -l) -if [ $mp4Count -ne 1 ]; then +if [ $mp4Count -gt 1 ]; then log "ERROR: More than 1 MP4 file found, performing cleanup..." find "$1" -type f -iname "*.mp4" -delete else + log "Searching for audiobook (m4b.mp4) files in completed download..." if [ $mp4Count -gt 0 ]; then log "$mp4Count M4B (m4b.mp4) files found, removing non m4b files..." find "$1" -type f -not -iname "*.m4b.mp4" -delete @@ -73,12 +73,12 @@ else fi fi -log "Searching for audiobook (mp3) files in completed download..." mp3Count=$(find "$1" -type f -iname "*.mp3" | wc -l) -if [ $mp3Count -ne 1 ]; then +if [ $mp3Count -gt 1 ]; then log "ERROR: More than 1 MP3 file found, performing cleanup..." find "$1" -type f -iname "*.mp3" -delete else + log "Searching for audiobook (mp3) files in completed download..." if [ $mp3Count -gt 0 ]; then log "$mp3Count MP3 files found, removing non mp3 files..." find "$1" -type f -not -iname "*.mp3" -delete From d4b81e29ba6fb1d8d0ad261185eb36563c437c78 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 28 Jan 2024 12:24:15 -0500 Subject: [PATCH 16/23] v1.0 - Swap beets installtion method #170 - Will this fix this problem...? No clue if it'll work... --- lidarr/setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lidarr/setup.bash b/lidarr/setup.bash index 38f058a..7239001 100644 --- a/lidarr/setup.bash +++ b/lidarr/setup.bash @@ -1,5 +1,6 @@ #!/usr/bin/with-contenv bash SMA_PATH="/usr/local/sma" +version=1.0" echo "*** install packages ***" && \ apk add -U --upgrade --no-cache \ @@ -22,10 +23,9 @@ apk add -U --upgrade --no-cache \ echo "*** install freyr client ***" && \ apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing atomicparsley && \ npm install -g miraclx/freyr-js &&\ -echo "*** install beets ***" && \ -apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community beets && \ echo "*** install python packages ***" && \ pip install --upgrade --no-cache-dir \ + beets \ yq \ pyacoustid \ requests \ From 827dc15e6f2508beece4d334b89811030fa7df6c Mon Sep 17 00:00:00 2001 From: norgur Date: Sun, 28 Jan 2024 19:48:48 +0100 Subject: [PATCH 17/23] Update setup.bash Fixed missing " --- lidarr/setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidarr/setup.bash b/lidarr/setup.bash index 7239001..9e21f12 100644 --- a/lidarr/setup.bash +++ b/lidarr/setup.bash @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash SMA_PATH="/usr/local/sma" -version=1.0" +version="1.0" echo "*** install packages ***" && \ apk add -U --upgrade --no-cache \ From 10d2079f6981bcf4e98d45033505a9284356e691 Mon Sep 17 00:00:00 2001 From: Aaron Wood Date: Wed, 31 Jan 2024 18:59:23 -0800 Subject: [PATCH 18/23] Always use most accurate way of fuzzy matching, greatly improve performance of fuzzy matching --- lidarr/Audio.service.bash | 99 +++++---------------------------------- lidarr/setup.bash | 5 +- 2 files changed, 15 insertions(+), 89 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 3dfe7af..9a3db7b 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.30" +scriptVersion="2.31" scriptName="Audio" ### Import Settings @@ -1269,7 +1269,7 @@ SearchProcess () { releaseProcessCount=$(( $releaseProcessCount + 1)) lidarrReleaseTitle="${lidarrReleaseTitles[$title]}" lidarrAlbumReleaseTitleClean=$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g') - lidarrAlbumReleaseTitleClean="${lidarrAlbumReleaseTitleClean:0:130}" + lidarrAlbumReleaseTitleClean="${lidarrAlbumReleaseTitleClean:0:130}" lidarrAlbumReleaseTitleSearchClean="$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" lidarrAlbumReleaseTitleFirstWord="$(echo "$lidarrReleaseTitle" | awk '{ print $1 }')" lidarrAlbumReleaseTitleFirstWord="${lidarrAlbumReleaseTitleFirstWord:0:3}" @@ -1432,16 +1432,7 @@ ArtistDeezerSearch () { deezerAlbumData="$(echo "$deezerArtistAlbumsData" | jq -r "select(.id==$deezerAlbumID)")" deezerAlbumTitle="$(echo "$deezerAlbumData" | jq -r ".title")" deezerAlbumTitleClean="$(echo ${deezerAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" - deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}" - # String Character Count test, quicker than the levenshtein method to allow faster processing - characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) - if [ "$characterMath" -gt "$matchDistance" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..." - continue - elif [ "$characterMath" -lt "0" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..." - continue - fi + deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}" GetDeezerAlbumInfo "$deezerAlbumID" deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")" deezerAlbumTrackCount="$(echo "$deezerAlbumData" | jq -r .nb_tracks)" @@ -1460,8 +1451,8 @@ ArtistDeezerSearch () { fi log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match..." - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity..." - diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${deezerAlbumTitleClean,,}" 2>/dev/null) + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Damerau-Levenshtein distance..." + diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${deezerAlbumTitleClean,,}\"))" 2>/dev/null) if [ "$diff" -le "$matchDistance" ]; then log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer MATCH Found :: Calculated Difference = $diff" @@ -1481,7 +1472,7 @@ ArtistDeezerSearch () { FuzzyDeezerSearch () { # Required Inputs # $1 Process ID - # $3 Lyric Type (explicit = true, clean = false) + # $2 Lyric Type (explicit = true, clean = false) if [ "$2" == "true" ]; then type="Explicit" @@ -1512,13 +1503,6 @@ FuzzyDeezerSearch () { deezerAlbumTitle="$(echo "$deezerAlbumTitle" | head -n1)" deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}" - # String Character Count test, quicker than the levenshtein method to allow faster processing - characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) - if [ "$characterMath" -gt "$matchDistance" ]; then - continue - elif [ "$characterMath" -lt "0" ]; then - continue - fi GetDeezerAlbumInfo "${deezerAlbumID}" deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")" @@ -1542,8 +1526,8 @@ FuzzyDeezerSearch () { fi log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match..." - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity..." - diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${deezerAlbumTitleClean,,}" 2>/dev/null) + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Damerau-Levenshtein distance..." + diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${deezerAlbumTitleClean,,}\"))" 2>/dev/null) if [ "$diff" -le "$matchDistance" ]; then log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer MATCH Found :: Calculated Difference = $diff" log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: Downloading $deezerAlbumTrackCount Tracks :: $deezerAlbumTitle ($downloadedReleaseYear)" @@ -1611,19 +1595,9 @@ ArtistTidalSearch () { downloadedReleaseYear="${downloadedReleaseDate:0:4}" downloadedTrackCount=$(echo "$tidalArtistAlbumData"| jq -r .numberOfTracks) - # String Character Count test, quicker than the levenshtein method to allow faster processing - characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) - if [ "$characterMath" -gt "$matchDistance" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..." - continue - elif [ "$characterMath" -lt "0" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..." - continue - fi - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Checking for Match..." - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Similarity..." - diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${tidalAlbumTitleClean,,}" 2>/dev/null) + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Damerau-Levenshtein distance..." + diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${tidalAlbumTitleClean,,}\"))" 2>/dev/null) if [ "$diff" -le "$matchDistance" ]; then log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal MATCH Found :: Calculated Difference = $diff" @@ -1679,19 +1653,9 @@ FuzzyTidalSearch () { downloadedReleaseYear="${downloadedReleaseDate:0:4}" downloadedTrackCount=$(echo "$tidalAlbumData"| jq -r .numberOfTracks) - # String Character Count test, quicker than the levenshtein method to allow faster processing - characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} )) - if [ "$characterMath" -gt "$matchDistance" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..." - continue - elif [ "$characterMath" -lt "0" ]; then - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..." - continue - fi - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Checking for Match..." - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Similarity..." - diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${tidalAlbumTitleClean,,}" 2>/dev/null) + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Damerau-Levenshtein distance..." + diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${tidalAlbumTitleClean,,}\"))" 2>/dev/null) if [ "$diff" -le "$matchDistance" ]; then log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal MATCH Found :: Calculated Difference = $diff" log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: Downloading $downloadedTrackCount Tracks :: $tidalAlbumTitle ($downloadedReleaseYear)" @@ -1787,45 +1751,6 @@ LidarrMissingAlbumSearch () { done } -function levenshtein { - if [ "$1" == "$2" ]; then - echo 0 - else - if (( $# != 2 )); then - echo "Usage: $0 word1 word2" >&2 - elif (( ${#1} < ${#2} )); then - levenshtein "$2" "$1" - else - local str1len=${#1} - local str2len=${#2} - local d - - for (( i = 0; i <= (str1len+1)*(str2len+1); i++ )); do - d[i]=0 - done - - for (( i = 0; i <= str1len; i++ )); do - d[i+0*str1len]=$i - done - - for (( j = 0; j <= str2len; j++ )); do - d[0+j*(str1len+1)]=$j - done - - for (( j = 1; j <= str2len; j++ )); do - for (( i = 1; i <= str1len; i++ )); do - [ "${1:i-1:1}" = "${2:j-1:1}" ] && local cost=0 || local cost=1 - del=$(( d[(i-1)+str1len*j]+1 )) - ins=$(( d[i+str1len*(j-1)]+1 )) - alt=$(( d[(i-1)+str1len*(j-1)]+cost )) - d[i+str1len*j]=$( echo -e "$del\n$ins\n$alt" | sort -n | head -1 ) - done - done - echo ${d[str1len+str1len*(str2len)]} - fi - fi -} - audioFlacVerification () { # Test Flac File for errors # $1 File for verification diff --git a/lidarr/setup.bash b/lidarr/setup.bash index 9e21f12..305e577 100644 --- a/lidarr/setup.bash +++ b/lidarr/setup.bash @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash SMA_PATH="/usr/local/sma" -version="1.0" +version="1.1" echo "*** install packages ***" && \ apk add -U --upgrade --no-cache \ @@ -27,6 +27,7 @@ echo "*** install python packages ***" && \ pip install --upgrade --no-cache-dir \ beets \ yq \ + pyxDamerauLevenshtein \ pyacoustid \ requests \ pylast \ @@ -46,7 +47,7 @@ touch ${SMA_PATH}/config/sma.log && \ chgrp users ${SMA_PATH}/config/sma.log && \ chmod g+w ${SMA_PATH}/config/sma.log && \ echo "************ install pip dependencies ************" && \ -python3 -m pip install --upgrade pip && \ +python3 -m pip install --upgrade pip && \ pip3 install -r ${SMA_PATH}/setup/requirements.txt mkdir -p /custom-services.d From dfc9d49a54d28552964fe900fdcc8c8e2dacb006 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 4 Feb 2024 16:27:00 -0500 Subject: [PATCH 19/23] Add skyscraper --- ra-rom-downloader/setup.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ra-rom-downloader/setup.bash b/ra-rom-downloader/setup.bash index bd89d98..e5123fa 100644 --- a/ra-rom-downloader/setup.bash +++ b/ra-rom-downloader/setup.bash @@ -1,5 +1,6 @@ #!/usr/bin/with-contenv bash RAHASHER_PATH="/usr/local/RALibretro" +SKYSCRAPER_PATH="/usr/local/skysource" echo "************ install dependencies ************" echo "************ install and upgrade packages ************" apt-get update @@ -18,6 +19,22 @@ apt-get install -y \ python3-pip \ rclone \ bsdmainutils +echo "************ skyscraper ************" +echo "************ install dependencies ************" +echo "************ install packages ************" +apt-get update +apt-get install -y \ + build-essential \ + wget \ + qt5-default +apt-get purge --auto-remove -y +apt-get clean +echo "************ install skyscraper ************" +mkdir -p ${SKYSCRAPER_PATH} +cd ${SKYSCRAPER_PATH} +wget https://raw.githubusercontent.com/Gemba/skyscraper/master/update_skyscraper.sh + + echo "************ RAHasher installation ************" mkdir -p ${RAHASHER_PATH} wget "https://github.com/RetroAchievements/RALibretro/releases/download/1.4.0/RAHasher-x64-Linux-1.6.0.zip" -O "${RAHASHER_PATH}/rahasher.zip" From 5b977c933489a64a145f9e89afb3ed62e7147b37 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 4 Feb 2024 16:30:10 -0500 Subject: [PATCH 20/23] Update setup.bash --- ra-rom-downloader/setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ra-rom-downloader/setup.bash b/ra-rom-downloader/setup.bash index e5123fa..efdce48 100644 --- a/ra-rom-downloader/setup.bash +++ b/ra-rom-downloader/setup.bash @@ -33,8 +33,8 @@ echo "************ install skyscraper ************" mkdir -p ${SKYSCRAPER_PATH} cd ${SKYSCRAPER_PATH} wget https://raw.githubusercontent.com/Gemba/skyscraper/master/update_skyscraper.sh - - +sed -i 's/sudo //g' update_skyscraper.sh +bash update_skyscraper.sh echo "************ RAHasher installation ************" mkdir -p ${RAHASHER_PATH} wget "https://github.com/RetroAchievements/RALibretro/releases/download/1.4.0/RAHasher-x64-Linux-1.6.0.zip" -O "${RAHASHER_PATH}/rahasher.zip" From 4c2c0b3dd89877344207625a132a17fa9009d69d Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Mon, 5 Feb 2024 14:21:23 +0000 Subject: [PATCH 21/23] new disableImvd setting Allows disabling IMVDB as a source for video script --- lidarr/extended.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/lidarr/extended.conf b/lidarr/extended.conf index ae40e55..743c826 100644 --- a/lidarr/extended.conf +++ b/lidarr/extended.conf @@ -67,6 +67,7 @@ autoArtistAdderMonitored="true" # true or false :: If true, artists tha addFeaturedVideoArtists="false" # true = enabled :: WARNING !!! WARNING !!! Enabling this can cause an endless loop of additional artists.... Enabling this will enable the extended Video script to automatically add Music Video Featured Artists to your existing Lidarr artists from IMVDB videoFormat="bv[width>=1920]+ba" # ONLY CHANGE if you know what your doing, for guidence, please see yt-dlp documentation. youtubeSubtitleLanguage="en" # Desired Language Code :: For guidence, please see yt-dlp documentation. +disableImvd="false" # true = enabled :: Use this to disable IMVDB as a source, will result in only tidal videos ##### PLEX NOTIFY SCRIPT plexUrl="" # ONLY used if PlexNotify.bash is used, example: http://x.x.x.x:32400 From 6cbec2ad330fb6d006ba1a962d23155eb4dbe9ff Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Mon, 5 Feb 2024 14:24:02 +0000 Subject: [PATCH 22/23] 3.6 - Use new disableImvd config setting Disables script if disableImvdb setting is true... --- lidarr/Video.service.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lidarr/Video.service.bash b/lidarr/Video.service.bash index 845b836..952bfff 100644 --- a/lidarr/Video.service.bash +++ b/lidarr/Video.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="3.5" +scriptVersion="3.6" scriptName="Video" ### Import Settings @@ -12,12 +12,22 @@ verifyConfig () { videoContainer="mkv" fi + if [ -z "$disableImvd" ]; then + disableImvd="fasle" + fi + if [ "$enableVideo" != "true" ]; then log "Script is not enabled, enable by setting enableVideo to \"true\" by modifying the \"/config/extended.conf\" config file..." log "Sleeping (infinity)" sleep infinity fi - + + if [ "$disableImvd" = "true" ]; then + log "Script is not enabled, enable by setting disableImvd to \"false\" by modifying the \"/config/extended.conf\" config file..." + log "Sleeping (infinity)" + sleep infinity + fi + if [ -z "$downloadPath" ]; then downloadPath="/config/extended/downloads" fi From c67d72522c42082a13379c660043b2584e4345ab Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Tue, 6 Feb 2024 16:21:41 +0000 Subject: [PATCH 23/23] 2.32 - Improve logging output for failed matches due to distance algorithm --- lidarr/Audio.service.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index 9a3db7b..4740bd1 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.31" +scriptVersion="2.32" scriptName="Audio" ### Import Settings @@ -1460,6 +1460,8 @@ ArtistDeezerSearch () { log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: Downloading $deezerAlbumTrackCount Tracks :: $deezerAlbumTitle ($downloadedReleaseYear)" DownloadProcess "$deezerAlbumID" "DEEZER" "$downloadedReleaseYear" "$deezerAlbumTitle" "$deezerAlbumTrackCount" + else + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer Match Not Found :: Calculated Difference ($diff) greater than $matchDistance" fi # End search if lidarr was successfully notified for import @@ -1533,6 +1535,8 @@ FuzzyDeezerSearch () { log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: Downloading $deezerAlbumTrackCount Tracks :: $deezerAlbumTitle ($downloadedReleaseYear)" DownloadProcess "$deezerAlbumID" "DEEZER" "$downloadedReleaseYear" "$deezerAlbumTitle" "$deezerAlbumTrackCount" + else + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer Match Not Found :: Calculated Difference ($diff) greater than $matchDistance" fi # End search if lidarr was successfully notified for import if [ "$lidarrDownloadImportNotfication" == "true" ]; then @@ -1610,7 +1614,7 @@ ArtistTidalSearch () { break fi else - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than 5" + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than $matchDistance" fi done @@ -1663,7 +1667,7 @@ FuzzyTidalSearch () { DownloadProcess "$tidalAlbumID" "TIDAL" "$downloadedReleaseYear" "$tidalAlbumTitle" "$downloadedTrackCount" else - log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than 5" + log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than $matchDistance" fi # End search if lidarr was successfully notified for import if [ "$lidarrDownloadImportNotfication" == "true" ]; then