mirror of
https://github.com/Jonny007-MKD/OTR-DecodeAll
synced 2025-01-22 08:49:50 +01:00
Divided config file into two functions.
This way some values can be overridden by command line arguments and others can use the final values of the variables
This commit is contained in:
parent
8fe46d9152
commit
8d1eba545c
2 changed files with 37 additions and 26 deletions
48
config
48
config
|
@ -2,29 +2,35 @@
|
|||
# Config #
|
||||
##########
|
||||
|
||||
user="" # OTR email address
|
||||
pass="" # OTR password
|
||||
function funcConfigPre { # These values are set at the beginning of the script
|
||||
user="" # OTR email address
|
||||
pass="" # OTR password
|
||||
|
||||
delugeDir="/etc/deluged" # Config dir of DelugeD
|
||||
inDir="/Multimedia/Video/.Downloaded" # Dir with .otrkeys
|
||||
uncutDir="/Multimedia/Video/.Uncut" # Dir with uncut videos (output of decoder)
|
||||
cutDir="/Multimedia/Video/.Uncut" # Dir with cut videos (output of cutter)
|
||||
outDir="/Multimedia/Video/" # Final dir with videos
|
||||
delugeDir="/etc/deluged" # Config dir of DelugeD
|
||||
inDir="/Multimedia/Video/.Downloaded" # Dir with .otrkeys
|
||||
uncutDir="/Multimedia/Video/.Uncut" # Dir with uncut videos (output of decoder)
|
||||
cutDir="/Multimedia/Video/.Uncut" # Dir with cut videos (output of cutter)
|
||||
outDir="/Multimedia/Video/" # Final dir with videos
|
||||
|
||||
torrentDb="/home/deluged/torrents.db" # File with file names and labels (see at github: OTR-TorrentDb)
|
||||
torrentDb="/home/deluged/torrents.db" # File with file names and labels (see at github: OTR-TorrentDb)
|
||||
|
||||
cmdDecode="/usr/bin/otrtool" # path to otrkey decoder
|
||||
cmdDecodeArgs="-x -e $user -p $pass -D $uncutDir" # for peropeters otrdecoder
|
||||
#cmdDecode="/home/pi/otr/otr/bin/qemu-x86_64 -L /home/pi/otr/otr /home/pi/otr/otr/bin64/otrdecoder-64 "
|
||||
#cmdDecodeArgs="-e $user -p $pass -o "$uncutDir" -i" # for original otrdecoder
|
||||
cmdCut="/home/deluged/multicutmkv.sh" # path to multicut
|
||||
cmdCutArgs=
|
||||
cmdSaneRenamix="/home/deluged/saneRenamix.sh" # path to saneRenamix
|
||||
cmdSaneRenamixArgs="-s -f"
|
||||
|
||||
logFile="/home/deluged/otrDecodeAll.log" # path to the log file
|
||||
# log levels: 0=off; 1=error; 2=warn; 3=info; 4 debug; 5 verbose debug
|
||||
logLevel=2 #level, which messages shall be written into the log.
|
||||
echoLevel=5 #level, which messages shall be written to stdout.
|
||||
logFile="/home/deluged/otrDecodeAll.log" # path to the log file
|
||||
# log levels: 0=off; 1=error; 2=warn; 3=info; 4 debug; 5 verbose debug
|
||||
logLevel=2 #level, which messages shall be written into the log.
|
||||
echoLevel=5 #level, which messages shall be written to stdout.
|
||||
}
|
||||
|
||||
|
||||
# These values are set after the command line arguments were parsed.
|
||||
# This way they can't be overridden, but can use the final config variables
|
||||
function funcConfigPost {
|
||||
cmdDecode="/usr/bin/otrtool" # path to otrkey decoder
|
||||
cmdDecodeArgs="-x -e $user -p $pass -D $uncutDir" # for peropeters otrdecoder
|
||||
#cmdDecode="/home/pi/otr/otr/bin/qemu-x86_64 -L /home/pi/otr/otr /home/pi/otr/otr/bin64/otrdecoder-64 "
|
||||
#cmdDecodeArgs="-e $user -p $pass -o "$uncutDir" -i" # for original otrdecoder
|
||||
cmdCut="/home/deluged/multicutmkv.sh" # path to multicut
|
||||
cmdCutArgs=
|
||||
cmdSaneRenamix="/home/deluged/saneRenamix.sh" # path to saneRenamix
|
||||
cmdSaneRenamixArgs="-s -f"
|
||||
|
||||
}
|
||||
|
|
15
otrDecodeAll
15
otrDecodeAll
|
@ -32,16 +32,19 @@ function funcLog {
|
|||
fi
|
||||
}
|
||||
|
||||
function funcPerformChecks {
|
||||
local exet;
|
||||
exet=0
|
||||
|
||||
function funcGetConfig {
|
||||
if [ ! -r "$PwD/config" ]; then
|
||||
funcLog 1 "$PwD/config does not exist"
|
||||
exit 1
|
||||
else
|
||||
. "$PwD/config"
|
||||
funcConfigPre
|
||||
fi
|
||||
}
|
||||
|
||||
function funcPerformChecks {
|
||||
local exet;
|
||||
exet=0
|
||||
|
||||
if ! type "$cmdDecode" >/dev/null 2>&1 ; then
|
||||
funcLog 1 "Please install otrtool"
|
||||
|
@ -103,6 +106,7 @@ function funcParam {
|
|||
echo "No argument value for option $OPTARG";;
|
||||
esac
|
||||
done
|
||||
funcConfigPost
|
||||
}
|
||||
|
||||
# Print some help text and explain parameters
|
||||
|
@ -351,8 +355,9 @@ function funcMove {
|
|||
success=1
|
||||
}
|
||||
|
||||
funcPerformChecks
|
||||
funcGetConfig
|
||||
funcParam "$@"
|
||||
funcPerformChecks
|
||||
funcLock
|
||||
funcProcessFiles
|
||||
funcUnlock
|
||||
|
|
Loading…
Reference in a new issue