v2.0 - Adjust temp download area to give additional seperation
This commit is contained in:
parent
d1ae752860
commit
60ef7e48a2
1 changed files with 68 additions and 66 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
scriptVersion="1.9"
|
scriptVersion="2.0"
|
||||||
scriptName="Audio"
|
scriptName="Audio"
|
||||||
|
|
||||||
log () {
|
log () {
|
||||||
|
@ -35,6 +35,8 @@ verifyConfig () {
|
||||||
if [ -z "$downloadPath" ]; then
|
if [ -z "$downloadPath" ]; then
|
||||||
downloadPath="/config/extended/downloads"
|
downloadPath="/config/extended/downloads"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
audioPath="$downloadPath/audio"
|
||||||
}
|
}
|
||||||
|
|
||||||
getArrAppInfo () {
|
getArrAppInfo () {
|
||||||
|
@ -137,7 +139,7 @@ Configuration () {
|
||||||
log "Add Deezer Related Artists is disabled (enable by setting addRelatedArtists=true)"
|
log "Add Deezer Related Artists is disabled (enable by setting addRelatedArtists=true)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Download Location: $downloadPath"
|
log "Download Location: $audioPath"
|
||||||
|
|
||||||
|
|
||||||
log "Output format: $audioFormat"
|
log "Output format: $audioFormat"
|
||||||
|
@ -186,7 +188,7 @@ Configuration () {
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadClientFreyr () {
|
DownloadClientFreyr () {
|
||||||
freyr --no-bar -d $downloadPath/incomplete deezer:album:$1
|
freyr --no-bar -d $audioPath/incomplete deezer:album:$1
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadFormat () {
|
DownloadFormat () {
|
||||||
|
@ -259,12 +261,12 @@ DownloadFormat () {
|
||||||
|
|
||||||
DownloadFolderCleaner () {
|
DownloadFolderCleaner () {
|
||||||
# check for completed download folder
|
# check for completed download folder
|
||||||
if [ -d "$downloadPath/complete" ]; then
|
if [ -d "$audioPath/complete" ]; then
|
||||||
log "Removing prevously completed downloads that failed to import..."
|
log "Removing prevously completed downloads that failed to import..."
|
||||||
# check for completed downloads older than 1 day
|
# check for completed downloads older than 1 day
|
||||||
if find "$downloadPath"/complete -mindepth 1 -type d -mtime +1 | read; then
|
if find "$audioPath"/complete -mindepth 1 -type d -mtime +1 | read; then
|
||||||
# delete completed downloads older than 1 day, these most likely failed to import due to Lidarr failing to match
|
# delete completed downloads older than 1 day, these most likely failed to import due to Lidarr failing to match
|
||||||
find "$downloadPath"/complete -mindepth 1 -type d -mtime +1 -exec rm -rf "{}" \; &>/dev/null
|
find "$audioPath"/complete -mindepth 1 -type d -mtime +1 -exec rm -rf "{}" \; &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -297,7 +299,7 @@ TidalClientSetup () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TidaldlStatusCheck
|
TidaldlStatusCheck
|
||||||
tidal-dl -o "$downloadPath"/incomplete
|
tidal-dl -o "$audioPath"/incomplete
|
||||||
DownloadFormat
|
DownloadFormat
|
||||||
|
|
||||||
if [ ! -f /config/xdg/.tidal-dl.token.json ]; then
|
if [ ! -f /config/xdg/.tidal-dl.token.json ]; then
|
||||||
|
@ -320,11 +322,11 @@ TidalClientSetup () {
|
||||||
rm /config/extended/cache/tidal/*-albums.json &>/dev/null
|
rm /config/extended/cache/tidal/*-albums.json &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$downloadPath/incomplete" ]; then
|
if [ ! -d "$audioPath/incomplete" ]; then
|
||||||
mkdir -p "$downloadPath"/incomplete
|
mkdir -p "$audioPath"/incomplete
|
||||||
chmod 777 "$downloadPath"/incomplete
|
chmod 777 "$audioPath"/incomplete
|
||||||
else
|
else
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TidaldlStatusCheck
|
TidaldlStatusCheck
|
||||||
|
@ -358,18 +360,18 @@ DownloadProcess () {
|
||||||
|
|
||||||
|
|
||||||
# Create Required Directories
|
# Create Required Directories
|
||||||
if [ ! -d "$downloadPath/incomplete" ]; then
|
if [ ! -d "$audioPath/incomplete" ]; then
|
||||||
mkdir -p "$downloadPath"/incomplete
|
mkdir -p "$audioPath"/incomplete
|
||||||
chmod 777 "$downloadPath"/incomplete
|
chmod 777 "$audioPath"/incomplete
|
||||||
else
|
else
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$downloadPath/complete" ]; then
|
if [ ! -d "$audioPath/complete" ]; then
|
||||||
mkdir -p "$downloadPath"/complete
|
mkdir -p "$audioPath"/complete
|
||||||
chmod 777 "$downloadPath"/complete
|
chmod 777 "$audioPath"/complete
|
||||||
else
|
else
|
||||||
rm -rf "$downloadPath"/complete/*
|
rm -rf "$audioPath"/complete/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "/config/extended/logs" ]; then
|
if [ ! -d "/config/extended/logs" ]; then
|
||||||
|
@ -404,7 +406,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')"
|
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 "$downloadPath"/complete -type d -iname "$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-*-$1-$2" | read; then
|
if find "$audioPath"/complete -type d -iname "$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-*-$1-$2" | read; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded..."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -452,7 +454,7 @@ DownloadProcess () {
|
||||||
if [ -z $arlToken ]; then
|
if [ -z $arlToken ]; then
|
||||||
DownloadClientFreyr $1
|
DownloadClientFreyr $1
|
||||||
else
|
else
|
||||||
deemix -b $deemixQuality -p "$downloadPath"/incomplete "https://www.deezer.com/album/$1"
|
deemix -b $deemixQuality -p "$audioPath"/incomplete "https://www.deezer.com/album/$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "/tmp/deemix-imgs" ]; then
|
if [ -d "/tmp/deemix-imgs" ]; then
|
||||||
|
@ -460,7 +462,7 @@ DownloadProcess () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify Client Works...
|
# Verify Client Works...
|
||||||
clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
clientTestDlCount=$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
||||||
if [ $clientTestDlCount -le 0 ]; then
|
if [ $clientTestDlCount -le 0 ]; then
|
||||||
# Add +1 to failed attempts
|
# Add +1 to failed attempts
|
||||||
deemixFail=$(( $deemixFail + 1))
|
deemixFail=$(( $deemixFail + 1))
|
||||||
|
@ -475,7 +477,7 @@ DownloadProcess () {
|
||||||
log "DEEZER :: ERROR :: Please review log for errors in client"
|
log "DEEZER :: ERROR :: Please review log for errors in client"
|
||||||
log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..."
|
log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..."
|
||||||
log "DEEZER :: ERROR :: Exiting..."
|
log "DEEZER :: ERROR :: Exiting..."
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
NotifyWebhook "FatalError" "DEEZER not authenticated but configured"
|
NotifyWebhook "FatalError" "DEEZER not authenticated but configured"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -484,10 +486,10 @@ DownloadProcess () {
|
||||||
if [ "$2" == "TIDAL" ]; then
|
if [ "$2" == "TIDAL" ]; then
|
||||||
TidaldlStatusCheck
|
TidaldlStatusCheck
|
||||||
|
|
||||||
tidal-dl -q $tidalQuality -o "$downloadPath/incomplete" -l "$1"
|
tidal-dl -q $tidalQuality -o "$audioPath/incomplete" -l "$1"
|
||||||
|
|
||||||
# Verify Client Works...
|
# Verify Client Works...
|
||||||
clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
clientTestDlCount=$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
||||||
if [ $clientTestDlCount -le 0 ]; then
|
if [ $clientTestDlCount -le 0 ]; then
|
||||||
# Add +1 to failed attempts
|
# Add +1 to failed attempts
|
||||||
tidaldlFail=$(( $tidaldlFail + 1))
|
tidaldlFail=$(( $tidaldlFail + 1))
|
||||||
|
@ -504,13 +506,13 @@ DownloadProcess () {
|
||||||
log "TIDAL :: ERROR :: Download failed"
|
log "TIDAL :: ERROR :: Download failed"
|
||||||
log "TIDAL :: ERROR :: You will need to re-authenticate on next script run..."
|
log "TIDAL :: ERROR :: You will need to re-authenticate on next script run..."
|
||||||
log "TIDAL :: ERROR :: Exiting..."
|
log "TIDAL :: ERROR :: Exiting..."
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
NotifyWebhook "FatalError" "TIDAL not authenticated but configured"
|
NotifyWebhook "FatalError" "TIDAL not authenticated but configured"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find "$downloadPath/incomplete" -type f -iname "*.flac" -newer "/temp-download" -print0 | while IFS= read -r -d '' file; do
|
find "$audioPath/incomplete" -type f -iname "*.flac" -newer "/temp-download" -print0 | while IFS= read -r -d '' file; do
|
||||||
audioFlacVerification "$file"
|
audioFlacVerification "$file"
|
||||||
if [ "$verifiedFlacFile" == "0" ]; then
|
if [ "$verifiedFlacFile" == "0" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: Verified"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: Verified"
|
||||||
|
@ -520,7 +522,7 @@ DownloadProcess () {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
downloadCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
downloadCount=$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
||||||
if [ "$downloadCount" -ne "$5" ]; then
|
if [ "$downloadCount" -ne "$5" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: download failed, missing tracks..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: download failed, missing tracks..."
|
||||||
completedVerification="false"
|
completedVerification="false"
|
||||||
|
@ -532,8 +534,8 @@ DownloadProcess () {
|
||||||
if [ "$completedVerification" == "true" ]; then
|
if [ "$completedVerification" == "true" ]; then
|
||||||
break
|
break
|
||||||
elif [ "$downloadTry" == "2" ]; then
|
elif [ "$downloadTry" == "2" ]; then
|
||||||
if [ -d "$downloadPath"/incomplete ]; then
|
if [ -d "$audioPath"/incomplete ]; then
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
@ -544,16 +546,16 @@ DownloadProcess () {
|
||||||
|
|
||||||
# Consolidate files to a single folder
|
# Consolidate files to a single folder
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Consolidating files to single folder"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Consolidating files to single folder"
|
||||||
find "$downloadPath/incomplete" -type f -exec mv "{}" "$downloadPath"/incomplete/ \;
|
find "$audioPath/incomplete" -type f -exec mv "{}" "$audioPath"/incomplete/ \;
|
||||||
find $downloadPath/incomplete/ -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \;
|
find $audioPath/incomplete/ -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \;
|
||||||
|
|
||||||
downloadCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
downloadCount=$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
||||||
if [ "$downloadCount" -gt "0" ]; then
|
if [ "$downloadCount" -gt "0" ]; then
|
||||||
# Check download for required quality (checks based on file extension)
|
# Check download for required quality (checks based on file extension)
|
||||||
DownloadQualityCheck "$downloadPath/incomplete" "$2"
|
DownloadQualityCheck "$audioPath/incomplete" "$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
downloadCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
downloadCount=$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
|
||||||
if [ "$downloadCount" -ne "$5" ]; then
|
if [ "$downloadCount" -ne "$5" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: All download Attempts failed..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: All download Attempts failed..."
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as failed download..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as failed download..."
|
||||||
|
@ -578,7 +580,7 @@ DownloadProcess () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Correct Artist/albumartist Flac files
|
# Correct Artist/albumartist Flac files
|
||||||
find "$downloadPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
find "$audioPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Setting ARTIST/ALBUMARTIST tag to \"$lidarrArtistName\" :: $file"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Setting ARTIST/ALBUMARTIST tag to \"$lidarrArtistName\" :: $file"
|
||||||
metaflac --remove-tag=ALBUMARTIST "$file"
|
metaflac --remove-tag=ALBUMARTIST "$file"
|
||||||
metaflac --remove-tag=ARTIST "$file"
|
metaflac --remove-tag=ARTIST "$file"
|
||||||
|
@ -596,7 +598,7 @@ DownloadProcess () {
|
||||||
rm /config/extended/beets-error
|
rm /config/extended/beets-error
|
||||||
fi
|
fi
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..."
|
||||||
ProcessWithBeets "$downloadPath/incomplete"
|
ProcessWithBeets "$audioPath/incomplete"
|
||||||
|
|
||||||
if [ -f /config/extended/beets-error ]; then
|
if [ -f /config/extended/beets-error ]; then
|
||||||
return
|
return
|
||||||
|
@ -604,7 +606,7 @@ DownloadProcess () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Embed Lyrics into Flac files
|
# Embed Lyrics into Flac files
|
||||||
find "$downloadPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
find "$audioPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
||||||
lrcFile="${file%.*}.lrc"
|
lrcFile="${file%.*}.lrc"
|
||||||
if [ -f "$lrcFile" ]; then
|
if [ -f "$lrcFile" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Embedding lyrics (lrc) into $file"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Embedding lyrics (lrc) into $file"
|
||||||
|
@ -636,7 +638,7 @@ DownloadProcess () {
|
||||||
extension="m4a"
|
extension="m4a"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find "$downloadPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' audio; do
|
find "$audioPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' audio; do
|
||||||
file="${audio}"
|
file="${audio}"
|
||||||
filename="$(basename "$audio")"
|
filename="$(basename "$audio")"
|
||||||
foldername="$(dirname "$audio")"
|
foldername="$(dirname "$audio")"
|
||||||
|
@ -664,65 +666,65 @@ DownloadProcess () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$enableReplaygainTags" == "true" ]; then
|
if [ "$enableReplaygainTags" == "true" ]; then
|
||||||
AddReplaygainTags "$downloadPath/incomplete"
|
AddReplaygainTags "$audioPath/incomplete"
|
||||||
else
|
else
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Replaygain Tagging Disabled (set enableReplaygainTags=true to enable...)"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Replaygain Tagging Disabled (set enableReplaygainTags=true to enable...)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
albumquality="$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | head -n 1 | egrep -i -E -o "\.{1}\w*$" | sed 's/\.//g')"
|
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 ($3)-${albumquality^^}-$1-$2"
|
||||||
|
|
||||||
find "$downloadPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do
|
find "$audioPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do
|
||||||
file="${audio}"
|
file="${audio}"
|
||||||
filenoext="${file%.*}"
|
filenoext="${file%.*}"
|
||||||
filename="$(basename "$audio")"
|
filename="$(basename "$audio")"
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
filenamenoext="${filename%.*}"
|
filenamenoext="${filename%.*}"
|
||||||
if [ ! -d "$downloadPath/complete" ]; then
|
if [ ! -d "$audioPath/complete" ]; then
|
||||||
mkdir -p "$downloadPath"/complete
|
mkdir -p "$audioPath"/complete
|
||||||
chmod 777 "$downloadPath"/complete
|
chmod 777 "$audioPath"/complete
|
||||||
fi
|
fi
|
||||||
mkdir -p "$downloadPath/complete/$downloadedAlbumFolder"
|
mkdir -p "$audioPath/complete/$downloadedAlbumFolder"
|
||||||
mv "$file" "$downloadPath/complete/$downloadedAlbumFolder"/
|
mv "$file" "$audioPath/complete/$downloadedAlbumFolder"/
|
||||||
|
|
||||||
done
|
done
|
||||||
chmod -R 777 "$downloadPath"/complete
|
chmod -R 777 "$audioPath"/complete
|
||||||
|
|
||||||
if [ -d "$downloadPath/complete/$downloadedAlbumFolder" ]; then
|
if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then
|
||||||
NotifyLidarrForImport "$downloadPath/complete/$downloadedAlbumFolder"
|
NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder"
|
||||||
|
|
||||||
LidarrTaskStatusCheck
|
LidarrTaskStatusCheck
|
||||||
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
||||||
if [ "$alreadyImported" == "true" ]; then
|
if [ "$alreadyImported" == "true" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$downloadPath/complete/$downloadedAlbumFolder" ]; then
|
if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then
|
||||||
NotifyLidarrForImport "$downloadPath/complete/$downloadedAlbumFolder"
|
NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder"
|
||||||
|
|
||||||
LidarrTaskStatusCheck
|
LidarrTaskStatusCheck
|
||||||
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
||||||
if [ "$alreadyImported" == "true" ]; then
|
if [ "$alreadyImported" == "true" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$downloadPath/complete/$downloadedAlbumFolder" ]; then
|
if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then
|
||||||
NotifyLidarrForImport "$downloadPath/complete/$downloadedAlbumFolder"
|
NotifyLidarrForImport "$audioPath/complete/$downloadedAlbumFolder"
|
||||||
|
|
||||||
LidarrTaskStatusCheck
|
LidarrTaskStatusCheck
|
||||||
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
CheckLidarrBeforeImport "$checkLidarrAlbumId"
|
||||||
if [ "$alreadyImported" == "true" ]; then
|
if [ "$alreadyImported" == "true" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$downloadPath/complete/$downloadedAlbumFolder" ]; then
|
if [ -d "$audioPath/complete/$downloadedAlbumFolder" ]; then
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
# NotifyPlexToScan
|
# NotifyPlexToScan
|
||||||
}
|
}
|
||||||
|
@ -749,7 +751,7 @@ ProcessWithBeets () {
|
||||||
beet -c /config/extended/beets-config.yaml -l /config/extended/beets-library.blb -d "$1" import -qC "$1"
|
beet -c /config/extended/beets-config.yaml -l /config/extended/beets-library.blb -d "$1" import -qC "$1"
|
||||||
if [ $(find "$1" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -newer "/config/beets-match" | wc -l) -gt 0 ]; then
|
if [ $(find "$1" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -newer "/config/beets-match" | wc -l) -gt 0 ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: SUCCESS: Matched with beets!"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: SUCCESS: Matched with beets!"
|
||||||
find "$downloadPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
find "$audioPath/incomplete" -type f -iname "*.flac" -print0 | while IFS= read -r -d '' file; do
|
||||||
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" | sed "s/null//g" | sed "/^$/d")"
|
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" | sed "s/null//g" | sed "/^$/d")"
|
||||||
metaflac --remove-tag=ALBUMARTIST "$file"
|
metaflac --remove-tag=ALBUMARTIST "$file"
|
||||||
metaflac --remove-tag=ALBUMARTIST_CREDIT "$file"
|
metaflac --remove-tag=ALBUMARTIST_CREDIT "$file"
|
||||||
|
@ -776,7 +778,7 @@ ProcessWithBeets () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get file metadata
|
# Get file metadata
|
||||||
GetFile=$(find "$downloadPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | head -n1)
|
GetFile=$(find "$audioPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | head -n1)
|
||||||
extension="${GetFile##*.}"
|
extension="${GetFile##*.}"
|
||||||
if [ "$extension" == "opus" ]; then
|
if [ "$extension" == "opus" ]; then
|
||||||
matchedTags=$(ffprobe -hide_banner -loglevel fatal -show_error -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json "$GetFile" | jq -r ".streams[].tags")
|
matchedTags=$(ffprobe -hide_banner -loglevel fatal -show_error -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json "$GetFile" | jq -r ".streams[].tags")
|
||||||
|
@ -816,7 +818,7 @@ ProcessWithBeets () {
|
||||||
if [ ${checkLidarrAlbumPercentOfTracks%%.*} -ge 100 ]; then
|
if [ ${checkLidarrAlbumPercentOfTracks%%.*} -ge 100 ]; then
|
||||||
if [ "$wantedAlbumListSource" == "missing" ]; then
|
if [ "$wantedAlbumListSource" == "missing" ]; then
|
||||||
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Already Imported Album (Missing)"
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Already Imported Album (Missing)"
|
||||||
rm -rf "$downloadPath/incomplete"/*
|
rm -rf "$audioPath/incomplete"/*
|
||||||
touch /config/extended/beets-error
|
touch /config/extended/beets-error
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
@ -936,11 +938,11 @@ DeemixClientSetup () {
|
||||||
rm /config/extended/cache/deezer/*-albums.json &>/dev/null
|
rm /config/extended/cache/deezer/*-albums.json &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$downloadPath/incomplete" ]; then
|
if [ ! -d "$audioPath/incomplete" ]; then
|
||||||
mkdir -p "$downloadPath"/incomplete
|
mkdir -p "$audioPath"/incomplete
|
||||||
chmod 777 "$downloadPath"/incomplete
|
chmod 777 "$audioPath"/incomplete
|
||||||
else
|
else
|
||||||
rm -rf "$downloadPath"/incomplete/*
|
rm -rf "$audioPath"/incomplete/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#log "DEEZER :: Upgrade deemix to the latest..."
|
#log "DEEZER :: Upgrade deemix to the latest..."
|
||||||
|
|
Loading…
Reference in a new issue