Add option to disable usage of parent directories

This commit is contained in:
Jonny007-MKD 2016-09-04 21:35:39 +02:00
parent 169b9646df
commit b6f0d40304
2 changed files with 27 additions and 4 deletions

View File

@ -24,10 +24,11 @@ function funcConfigPre { # These values are set at the beginning of the script
# 1st arg: Label
# 2nd arg: Each movie with this label will be moved to this subdirectory of $outDir
# 3rd arg: (optional) Whether SaneRenamix shall be used for movies with this label (default: false)
addLabel "movie" "Filme" 0
addLabel "movie-en" "Filme-En" "false"
# 4th arg: (optional) Whether the name of the movie/series shall be used as parent directory (default: true)
addLabel "movie" "Filme" 0 0
addLabel "movie-en" "Filme-En" "false" "false"
addLabel "docu" "Dokumentationen"
addLabel "tvserie" "Serien" true
addLabel "tvserie" "Serien" true true
umask 0002 # Set permissions 775/664 per default
}

View File

@ -19,6 +19,7 @@ lastProcessingEchoedNL=0
warnUnknownLabel=true
declare -A label2Dir
declare -A label2SaneRename
declare -A label2UseDirAsParent
PwD=$(readlink -e $0) # Get the path to this script
@ -111,12 +112,30 @@ function funcUnlock {
# Add label to dictionary
function addLabel {
success=1;
dir=1;
case $# in
[0-1])
funcLog 1 "Not enough arguments given for addLabel! Give at least name and directory"
success=0;;
2)
sr=0;;
4)
case $4 in
0) ;&
[fF]) ;&
false) ;&
no)
dir=0;;
1) ;&
[tT]) ;&
true) ;&
yes)
dir=1;;
*)
funcLog 1 "addLabel: Could not understand fourth argument \"$4\"! Please give \"true\" or \"false\" to specify whether the name of the movie/episode shall be used as parent directory."
success=0;;
esac;& # goto 3)
3)
case $3 in
0) ;&
@ -148,6 +167,7 @@ function addLabel {
funcLog 5 "Adding label \"$1\" with dir = \"$2\" and sanerename = $sr"
label2Dir["$1"]="$2";
label2SaneRename["$1"]=$sr;
label2UseDirAsParent["$1"]=$dir;
fi
}
@ -564,7 +584,9 @@ function funcMakeVars {
funcLog 5 "pathAbsOutCutInsane: $pathAbsOutCutInsane"
fi
pathAbsOutDecoded="$pathAbsOutDecoded/$bibname" # Append bibname: This is the series name or the movie name (Kodi likes this)
if [ "${label2UseDirAsParent["$label"]}" -ne 0 ]; then
pathAbsOutDecoded="$pathAbsOutDecoded/$bibname" # Append bibname: This is the series name or the movie name (Kodi likes this)
fi
# This will be the absolute path to the output file (e.g. /final/Good.Wife/Good.Wife..S05E14..Ein.paar.Worte.HQ.avi)
pathAbsOutDecoded="$outDir/$pathAbsOutDecoded/$sanename"