From b889a0855ae4b0f97b58b413923b9a36915870b2 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 14 Jul 2022 12:51:07 -0400 Subject: [PATCH] v1.0.173 - Add Album ID to downloadedAlbumFolder Name --- root/scripts/download.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/root/scripts/download.sh b/root/scripts/download.sh index 2810378..5f8056b 100644 --- a/root/scripts/download.sh +++ b/root/scripts/download.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.172" +scriptVersion="1.0.173" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" = "null" ]; then lidarrUrlBase="" @@ -455,7 +455,7 @@ DownloadProcess () { downloadedAlbumTitleClean="$(echo "$4" | sed -e "s%[^[:alpha:][:digit:]._' ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" - if find /downloads/lidarr-extended/complete -type d -iname "$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-*-$2" | read; then + if find /downloads/lidarr-extended/complete -type d -iname "$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-*-$1-$2" | read; then log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded..." return fi @@ -665,7 +665,7 @@ DownloadProcess () { done albumquality="$(find /downloads/lidarr-extended/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^^}-$2" + downloadedAlbumFolder="$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-${albumquality^^}-$1-$2" find "/downloads/lidarr-extended/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do file="${audio}" @@ -686,7 +686,7 @@ DownloadProcess () { chown -R abc:abc /downloads/lidarr-extended/complete log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..." - ProcessWithBeets "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" "${albumquality^^}" "$2" + ProcessWithBeets "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" "${albumquality^^}" "$2" "$1" if [ -d "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" ]; then NotifyLidarrForImport "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" @@ -1824,7 +1824,12 @@ FuzzyTidalSearch () { ProcessWithBeets () { - + # Input + # $1 Download Folder to process + # $2 Detected Quality + # $3 Download Client Used + # $4 Album ID + trackcount=$(find "$1" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) if [ -f /scripts/library.blb ]; then @@ -1949,7 +1954,7 @@ ProcessWithBeets () { matchedLidarrAlbumArtistCleanName="$(echo "$matchedLidarrAlbumArtistName" | sed -e "s%[^[:alpha:][:digit:]._()' -]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" - downloadedAlbumFolder="${matchedLidarrAlbumArtistCleanName}-${matchedTagsAlbumTitleClean} ($matchedTagsAlbumYear)-${albumquality^^}-$3" + downloadedAlbumFolder="${matchedLidarrAlbumArtistCleanName}-${matchedTagsAlbumTitleClean} ($matchedTagsAlbumYear)-${albumquality^^}-$4-$3" if [ "$1" != "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" ];then if [ -d "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" ]; then rm -rf "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"