From 7c7c404a9fb8ee9f202ac1478196ab071d6e0557 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 17 Aug 2023 10:13:44 +0000 Subject: [PATCH] v2.12 - Rollback #59 --- lidarr/Audio.service.bash | 122 +------------------------------------- 1 file changed, 1 insertion(+), 121 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index d734fbb..6a7ac9e 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.13" +scriptVersion="2.12" scriptName="Audio" ### Import Settings @@ -1387,126 +1387,6 @@ SearchProcess () { touch "/config/extended/logs/notfound/$wantedAlbumId--$lidarrArtistForeignArtistId--$lidarrAlbumForeignAlbumId" chmod 777 "/config/extended/logs/notfound/$wantedAlbumId--$lidarrArtistForeignArtistId--$lidarrAlbumForeignAlbumId" fi - - if [ $notFoundYoutubeFallback == "true" ]; then - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Falling back to YouTube" - - lidarrAlbumData=$(curl -X GET "$arrUrl/api/v1/album/${checkLidarrAlbumId}" --header "X-Api-Key:"${arrApiKey} -H "Content-Type: application/json") - - lidarrAlbumId=$(jq -r '.releases[0].albumId' <<< "$lidarrAlbumData") - tracks=$(curl -X GET "$arrUrl/api/v1/track?albumId=${lidarrAlbumId}" --header "X-Api-Key:"${arrApiKey} -H "Content-Type: application/json") - - downloadedAlbumTitleClean="$(echo "$4" | sed -e "s%[^[:alpha:][:digit:]._' ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" - downloadedAlbumFolder="$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-${albumquality^^}-$1-$2" - - if [[ -z $lidarrAlbumId ]]; then - echo "Album not found on Lidarr." - else - if [ -d "/temp-yt-dl" ]; then - rm -rf "/temp-yt-dl" - fi - - mkdir -p /temp-yt-dl/ - chmod 777 -R /temp-yt-dl/ - chmod 777 -R "${audioPath}/incomplete/" - - trackLength=$(echo $tracks | jq length) - trackLength=$((trackLength-1)) - for i in `seq 0 $trackLength` - do - trackTitle=$(jq -r ".[$i].title" <<< "$tracks") - trackId=$(jq -r ".[$i].foreignTrackId" <<< "$tracks") - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: $trackTitle :: Downloading from YouTube" - yt-dlp -q --audio-quality highest --audio-format aac -o "/temp-yt-dl/${trackId}" -x "ytsearch:${lidarrArtistName} - ${trackTitle} (Audio)" - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: $trackTitle :: Adding metadata" - ffmpeg -hide_banner -loglevel error -i "/temp-yt-dl/${trackId}.m4a" -metadata title="${trackTitle}" -metadata artist="${lidarrArtistName}" -metadata album="${lidarrAlbumTitle}" "${audioPath}/incomplete/${trackId}.m4a" - done - - if [ -d "/temp-yt-dl" ]; then - rm -rf "/temp-yt-dl" - fi - - if [ "$enableBeetsTagging" == "true" ]; then - if [ -f /config/extended/beets-error ]; then - rm /config/extended/beets-error - fi - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..." - ProcessWithBeets "$audioPath"/incomplete/ - - if [ -f /config/extended/beets-error ]; then - return - fi - fi - - if [ "$enableReplaygainTags" == "true" ]; then - AddReplaygainTags "$audioPath/incomplete" - else - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Replaygain Tagging Disabled (set enableReplaygainTags=true to enable...)" - 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" - - find "$audioPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do - file="${audio}" - filenoext="${file%.*}" - filename="$(basename "$audio")" - extension="${filename##*.}" - filenamenoext="${filename%.*}" - if [ ! -d "$audioPath/complete" ]; then - mkdir -p "$audioPath"/complete - chmod 777 "$audioPath"/complete - fi - mkdir -p "$audioPath/complete/$downloadedAlbumFolder" - mv "$file" "$audioPath/complete/$downloadedAlbumFolder"/ - done - - chmod -R 777 "$audioPath"/complete - - if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then - NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder" - - LidarrTaskStatusCheck - CheckLidarrBeforeImport "$checkLidarrAlbumId" - if [ "$alreadyImported" == "true" ]; then - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..." - rm -rf "$audioPath"/incomplete/* - fi - fi - - if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then - NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder" - - LidarrTaskStatusCheck - CheckLidarrBeforeImport "$checkLidarrAlbumId" - if [ "$alreadyImported" == "true" ]; then - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..." - rm -rf "$audioPath"/incomplete/* - fi - fi - - if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then - NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder" - - LidarrTaskStatusCheck - CheckLidarrBeforeImport "$checkLidarrAlbumId" - if [ "$alreadyImported" == "true" ]; then - log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..." - rm -rf "$audioPath"/incomplete/* - fi - fi - - if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then - rm -rf "$audioPath"/incomplete/* - fi - - LidarrTaskStatusCheck - CheckLidarrBeforeImport "$checkLidarrAlbumId" - if [ "$alreadyImported" == "true" ]; then - break - fi - fi - 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