Update audio-pp.bash

pull/11/head
RandomNinjaAtk 4 years ago committed by GitHub
parent 1c9fada994
commit a669394a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,9 @@
#!/usr/bin/with-contenv bash
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
TITLESHORT="APP"
Main () {
# SETTINGS
AudioVerification="${AUDIO_VERIFY}" # TRUE = ENABLED, Verifies FLAC/MP3 files for errors (fixes MP3's, deletes bad FLAC files)
ConversionFormat="${AUDIO_FORMAT}" # SET TO: OPUS or AAC or MP3 or ALAC or FLAC - converts lossless FLAC files to set format
@ -7,7 +11,6 @@ ConversionBitrate="${AUDIO_BITRATE}" # Set to desired bitrate when converting to
ReplaygainTagging="${AUDIO_REPLAYGAIN}" # TRUE = ENABLED, adds replaygain tags for compatible players (FLAC ONLY)
DetectNonSplitAlubms="${AUDIO_DSFA}" # TRUE = ENABLED :: Uses "MaxFileSize" to detect and mark download as failed if detected
MaxFileSize="${AUDIO_DSFAS}" # M = MB, G = GB :: Set size threshold for detecting single file albums
RequireBeetsMatch="${AUDIO_REQUIREBEETSTAGGING}" # true = enabled :: skips importing files that could not be matched using beets
#============FUNCTIONS============
@ -36,16 +39,7 @@ if [ "${DetectNonSplitAlubms}" = TRUE ]; then
else
echo "DetectNonSplitAlubms: DISABLED"
fi
if [ "${TagWithBeets}" = TRUE ]; then
echo "Tag with Beets: ENABLED"
else
echo "Tag with Beets: DISABLED"
fi
if [ "${RequireBeetsMatch}" = true ]; then
echo "Require Beets Match: ENABLED"
else
echo "Require Beets Match: DISABLED"
fi
echo "Processing: $1"
}
@ -196,40 +190,6 @@ replaygain () {
fi
}
beets () {
trackcount=$(find "$1" -type f -iregex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
echo "Matching $trackcount tracks with Beets"
touch "$1/beets-match"
sleep 0.1
if find "$1" -type f -iregex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | read; then
beet -c "/config/scripts/configs/beets-config.yaml" -l "$1/beets-library.blb" -d "$1" import -q "$1"
if find "$1" -type f -iregex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -newer "$1/beets-match" | read; then
echo "SUCCESS: Matched with beets!"
else
if [ "$RequireBeetsMatch" = true ]; then
echo "ERROR: RequireBeetsMatch enabled, performing cleanup"
rm -rf "$1"/*
sleep 0.1
exit 1
else
echo "ERROR: Unable to match using beets, fallback to lidarr import matching..."
fi
fi
fi
if [ -f "$1/beets-match" ]; then
rm "$1/beets-match"
sleep 0.1
fi
if [ -f "$1/beets-library.blb" ]; then
rm "$1/beets-library.blb"
sleep 0.1
fi
}
#============START SCRIPT============
settings "$1"
@ -250,3 +210,10 @@ fi
echo ""
echo "Post Processing Complete!" && exit 0
#============END SCRIPT============
}
Main "$@" | tee -a /config/scripts/logs/audio-pp.log
chmod 666 /config/scripts/logs/audio-pp.log
chown abc:abc /config/scripts/logs/audio-pp.log
exit $?

Loading…
Cancel
Save