v1.0.271 - Add Version to logging output, imrpove beets process

pull/139/head
RandomNinjaAtk 2 years ago committed by GitHub
parent a9d2a4ec86
commit 3bcab36196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.0.270" scriptVersion="1.0.271"
if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
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
@ -35,7 +35,7 @@ sleepTimer=0.5
log () { log () {
m_time=`date "+%F %T"` m_time=`date "+%F %T"`
echo $m_time" :: Extended Audio :: "$1 echo $m_time" :: Extended Audio :: $scriptVersion :: "$1
} }
# auto-clean up log file to reduce space usage # auto-clean up log file to reduce space usage
@ -656,7 +656,7 @@ DownloadProcess () {
touch /config/extended/logs/downloaded/tidal/$1 touch /config/extended/logs/downloaded/tidal/$1
fi fi
if [ $enableBeetsTagging = true ]; then if [ "$enableBeetsTagging" == "true" ]; then
log "$processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..." log "$processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Processing files with beets..."
ProcessWithBeets "$downloadPath/incomplete" ProcessWithBeets "$downloadPath/incomplete"
fi fi
@ -748,30 +748,33 @@ ProcessWithBeets () {
# $1 Download Folder to process # $1 Download Folder to process
if [ -f /config/extended/beets-library.blb ]; then if [ -f /config/extended/beets-library.blb ]; then
rm /config/extended/beets-library.blb rm /config/extended/beets-library.blb
sleep 0.1 sleep 0.5
fi fi
if [ -f /config/extended/logs/beets.log ]; then if [ -f /config/extended/logs/beets.log ]; then
rm /config/extended/logs/beets.log rm /config/extended/logs/beets.log
sleep 0.1 sleep 0.5
fi fi
if [ -f "/config/beets-match" ]; then if [ -f "/config/beets-match" ]; then
rm "/config/beets-match" rm "/config/beets-match"
sleep 0.1 sleep 0.5
fi fi
touch "/config/beets-match" touch "/config/beets-match"
sleep 0.1 sleep 0.5
beet -c /config/extended/scripts/beets-config.yaml -l /config/extended/beets-library.blb-d "$1" import -qC "$1" beet -c /config/extended/scripts/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 "$processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: SUCCESS: Matched with beets!" log "$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 "$downloadPath/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")"
metaflac --remove-tag=ALBUMARTIST "$file" metaflac --remove-tag=ALBUMARTIST "$file"
metaflac --remove-tag=ALBUMARTIST_CREDIT "$file" metaflac --remove-tag=ALBUMARTIST_CREDIT "$file"
metaflac --remove-tag=ALBUMARTISTSORT "$file" metaflac --remove-tag=ALBUMARTISTSORT "$file"
metaflac --remove-tag=ALBUM_ARTIST "$file" metaflac --remove-tag=ALBUM_ARTIST "$file"
metaflac --remove-tag="ALBUM ARTIST" "$file" metaflac --remove-tag="ALBUM ARTIST" "$file"
metaflac --remove-tag=ARTISTSORT "$file" metaflac --remove-tag=ARTISTSORT "$file"
metaflac --remove-tag=ARTIST "$file"
metaflac --set-tag=ARTIST="$getArtistCredit" "$file"
done done
else else
log "$processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Unable to match using beets to a musicbrainz release..." log "$processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Unable to match using beets to a musicbrainz release..."

Loading…
Cancel
Save