|
|
@ -1,5 +1,5 @@
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
scriptVersion="1.0.131"
|
|
|
|
scriptVersion="1.0.132"
|
|
|
|
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
|
|
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
|
|
if [ "$lidarrUrlBase" = "null" ]; then
|
|
|
|
if [ "$lidarrUrlBase" = "null" ]; then
|
|
|
|
lidarrUrlBase=""
|
|
|
|
lidarrUrlBase=""
|
|
|
@ -23,6 +23,7 @@ musicbrainzMirror=https://musicbrainz.org
|
|
|
|
#addRelatedArtists=true
|
|
|
|
#addRelatedArtists=true
|
|
|
|
#numberOfRelatedArtistsToAddPerArtist=1
|
|
|
|
#numberOfRelatedArtistsToAddPerArtist=1
|
|
|
|
#beetsMatchPercentage=85
|
|
|
|
#beetsMatchPercentage=85
|
|
|
|
|
|
|
|
#requireQuality=true
|
|
|
|
|
|
|
|
|
|
|
|
sleepTimer=0.5
|
|
|
|
sleepTimer=0.5
|
|
|
|
|
|
|
|
|
|
|
@ -121,6 +122,12 @@ Configuration () {
|
|
|
|
log ":: Output format = $audioFormat"
|
|
|
|
log ":: Output format = $audioFormat"
|
|
|
|
log ":: Output bitrate = $audioBitrate"
|
|
|
|
log ":: Output bitrate = $audioBitrate"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$requireQuality" = "true" ]; then
|
|
|
|
|
|
|
|
log ":: Download Quality Check Enabled"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: Download Quality Check Disabled (enable by setting: requireQuality=true"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ $audioLyricType = both ] || [ $audioLyricType = explicit ] || [ $audioLyricType = explicit ]; then
|
|
|
|
if [ $audioLyricType = both ] || [ $audioLyricType = explicit ] || [ $audioLyricType = explicit ]; then
|
|
|
|
log ":: Preferred audio lyric type: $audioLyricType"
|
|
|
|
log ":: Preferred audio lyric type: $audioLyricType"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -596,9 +603,12 @@ DownloadProcess () {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check download for required quality (checks based on file extension)
|
|
|
|
|
|
|
|
DownloadQualityCheck "/downloads/lidarr-extended/incomplete" "$2"
|
|
|
|
|
|
|
|
|
|
|
|
downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
|
|
|
downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
|
|
|
if [ $downloadCount -le 0 ]; then
|
|
|
|
if [ $downloadCount -le 0 ]; then
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: All download Attempst failed..."
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: All download Attempts failed..."
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -670,6 +680,59 @@ DownloadProcess () {
|
|
|
|
# NotifyPlexToScan
|
|
|
|
# NotifyPlexToScan
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DownloadQualityCheck () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$requireQuality" = "true" ]; then
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Checking for unwanted files"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $audioFormat != native ]; then
|
|
|
|
|
|
|
|
if find "$1" -type f -regex ".*/.*\.\(opus\|m4a\|mp3\)"| read; then
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Unwanted files found!"
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Performing cleanup..."
|
|
|
|
|
|
|
|
rm "$1"/*
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No unwanted files found!"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $audioFormat = native ]; then
|
|
|
|
|
|
|
|
if [ $audioBitrate = lossless ]; then
|
|
|
|
|
|
|
|
if find "$1" -type f -regex ".*/.*\.\(opus\|m4a\|mp3\)"| read; then
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Unwanted files found!"
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Performing cleanup..."
|
|
|
|
|
|
|
|
rm "$1"/*
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No unwanted files found!"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [ $2 = DEEZER ]; then
|
|
|
|
|
|
|
|
if find "$1" -type f -regex ".*/.*\.\(opus\|m4a\|flac\)"| read; then
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Unwanted files found!"
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Performing cleanup..."
|
|
|
|
|
|
|
|
rm "$1"/*
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No unwanted files found!"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [ $2 = TIDAL ]; then
|
|
|
|
|
|
|
|
if find "$1" -type f -regex ".*/.*\.\(opus\|flac\|mp3\)"| read; then
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Unwanted files found!"
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Performing cleanup..."
|
|
|
|
|
|
|
|
rm "$1"/*
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No unwanted files found!"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Skipping download quality check... (enable by setting: requireQuality=true)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AddReplaygainTags () {
|
|
|
|
|
|
|
|
if [ "$replaygain" == "true" ]; then
|
|
|
|
|
|
|
|
log "$logheader :: DOWNLOAD :: Adding Replaygain Tags using r128gain"
|
|
|
|
|
|
|
|
r128gain -r -a -c $POSTPROCESSTHREADS "$DOWNLOADS/amd/dlclient"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NotifyLidarrForImport () {
|
|
|
|
NotifyLidarrForImport () {
|
|
|
|
LidarrProcessIt=$(curl -s "$lidarrUrl/api/v1/command" --header "X-Api-Key:"${lidarrApiKey} -H "Content-Type: application/json" --data "{\"name\":\"DownloadedAlbumsScan\", \"path\":\"$1\"}")
|
|
|
|
LidarrProcessIt=$(curl -s "$lidarrUrl/api/v1/command" --header "X-Api-Key:"${lidarrApiKey} -H "Content-Type: application/json" --data "{\"name\":\"DownloadedAlbumsScan\", \"path\":\"$1\"}")
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: LIDARR IMPORT NOTIFICATION SENT! :: $1"
|
|
|
|
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: LIDARR IMPORT NOTIFICATION SENT! :: $1"
|
|
|
|