From bddafa0705bef519935a5a85e7e3fa54d2f8ccfb Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Tue, 28 Oct 2014 21:42:41 +0100 Subject: [PATCH] Fix syntax error Get label before making all other variables --- otrDecodeAll | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/otrDecodeAll b/otrDecodeAll index c37f036..843fddf 100755 --- a/otrDecodeAll +++ b/otrDecodeAll @@ -12,6 +12,8 @@ logMsgColor=("\033[37m" "\033[31m" "\033[33m" "\033[37m" "\033[37m" "\033[37m") logLevel=0 echoLevel=5 lastXbmcCheck=0 +umask 0002 # Set permissions 775/664 per default + PwD=$(readlink -e $0) # Get the path to this script PwD=$(dirname "$PwD") @@ -180,6 +182,11 @@ function funcUnlock { rm -f /tmp/.otrDecodeAll.lock } +function funcGetLabel { + label="$(grep "$filename" $torrentDb | grep -o ' [a-zA-Z0-9_-]*$' | grep -o '[a-zA-Z0-9_-]*$')" + funcLog 5 "label: $label" +} + function funcMakeVars { funcLog 5 "filename: $filename" @@ -192,9 +199,6 @@ function funcMakeVars { pathCut="$cutDir/$filename.mkv" funcLog 5 "pathCut: $pathCut" - label="$(grep "$filename" $torrentDb | grep -o ' [a-zA-Z0-9_-]*$' | grep -o '[a-zA-Z0-9_-]*$')" - funcLog 5 "label: $label" - sanename=$filename bibname=${filename%%_[0-9][0-9].*} bibname="${bibname//_/.}" @@ -260,10 +264,10 @@ function funcProcessFiles { filename="${filename%.otrkey}" echo; funcLog 0 "Processing $filename"; - funcMakeVars $file - echo -e " >> \033[32m$sanename\033[37m"; + funcGetLabel - if [ -n "$labelFilter" ] && [[ "$labelFilter" != "$label" ]] + + if [ -n "$labelFilter" ] && [[ "$labelFilter" != "$label" ]]; then funcLog 4 "Label did not match filter. Skipping"; continue; fi @@ -272,6 +276,10 @@ function funcProcessFiles { continue; fi + funcMakeVars + echo -e " >> \033[32m$sanename\033[37m"; + + if [ -f "$pathOut" ]; then funcLog 4 "File was already handled." funcRemove $file