From c0a3d33142cd815dc092559bb6e61db9ca296946 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 19 Jul 2023 17:45:41 -0400 Subject: [PATCH] 1.4 - use new settings --- sabnzbd/audiobook.bash | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sabnzbd/audiobook.bash b/sabnzbd/audiobook.bash index b30e1c9..3b39709 100644 --- a/sabnzbd/audiobook.bash +++ b/sabnzbd/audiobook.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -ScriptVersion="1.3" +ScriptVersion="1.4" scriptName="Audiobook" #### Import Settings @@ -10,6 +10,13 @@ log () { echo $m_time" :: $scriptName :: $ScriptVersion :: "$1 } +if [ -z $allowM4b ]; then + allowM4b=true +fi + +if [ -z $allowMp3 ]; then + allowMp3=false +fi set -e set -o pipefail @@ -94,6 +101,22 @@ if [ "$bookfound" == "false" ]; then fi fi +if [ "$allowM4b" != "true" ]; + if [ $allowM4b -gt 0 ]; then + log "M4B's disabled via config file, performing cleanup..." + rm "$1"/* + error="true" + fi +fi + +if [ "$allowMp3" != "true" ]; + if [ $mp3Count -gt 0 ]; then + log "MP3's disabled via config file, performing cleanup..." + rm "$1"/* + error="true" + fi +fi + if [ "$error" == "true" ]; then echo "ERROR: No audiobook files found" && exit 1 fi