remove redundancy code
This commit is contained in:
parent
3d291d2e6d
commit
8f1e932f1a
@ -29,6 +29,7 @@ readonly DATE=$(date '+%Y-%m-%d')
|
|||||||
echo "$0 is part of the TerabyteTerminator Project"
|
echo "$0 is part of the TerabyteTerminator Project"
|
||||||
echo ""
|
echo ""
|
||||||
echo "update-file-state (moviedir)"
|
echo "update-file-state (moviedir)"
|
||||||
|
echo "config: $globalconf"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,22 +109,9 @@ function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
## help functions #########
|
## sub functions #########
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
##check & prepair args
|
|
||||||
[ -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
|
|
||||||
}
|
|
||||||
[ -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="/"
|
|
||||||
|
|
||||||
# file_add [rel.path] (md5)
|
# file_add [rel.path] (md5)
|
||||||
function file_add() {
|
function file_add() {
|
||||||
local MD5="$2"
|
local MD5="$2"
|
||||||
|
Loading…
Reference in New Issue
Block a user