use glabal lib for moviedir set

This commit is contained in:
6543 2019-05-12 00:36:30 +02:00
parent c533881fac
commit 01086b336c
1 changed files with 9 additions and 13 deletions

View File

@ -54,20 +54,16 @@ fi
exit 0
}

##check & prepair args
[ "${mode:0:1}" == "e" ] && touch "$md5list"
[ -f "$md5list" ] || { echo "md5list \"$md5list\" do not exist"; exit 1; } # check md5
[ -z "$moviedir" ] && [ -f "$globalconf" ] && { # if (no argument) and (globalconf exist)
if [ -z "$(grep "moviedir=" "$globalconf" )" ]; then # and (moviedir is NOT in globalconf)
echo 'neither "movie folder" is set in global config nor given as argument'
exit 2
else # and (moviedir is in globalconf)
moviedir="$(grep "moviedir=" "$globalconf" | cut -d '=' -f 2)"
fi
## Checks
[ "${mode:0:1}" == "e" ] && touch "$md5list" || {
echo "ERROR: cant creat MD5 File on this PLACE"
exit 1
}
# check if md5 file exist
[ -f "$md5list" ] || {
echo "md5list \"$md5list\" do not exist"
exit 1
}
[ -d "$moviedir" ] || { echo "moviedir \"$moviedir\" do not exist"; exit 3; } # check moviedir
moviedir=""$(echo $moviedir | sed 's|/$||g')""
[ -z "$moviedir" ] && exit 255 #catch case moviedir="/"

#db checks
[ "$(db_check)" == $FALSE ] && {