111 lines
4.7 KiB
Plaintext
Executable File
111 lines
4.7 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
proc log {msg {level 1}} {
|
|
if {$level > $::loglevel} return
|
|
puts $::logfd "[\
|
|
clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S"\
|
|
] DA([pid])- $msg"
|
|
flush $::logfd
|
|
}
|
|
|
|
source /mod/webif/plugin/detectads/harness.jim
|
|
set opt "-h"
|
|
set file ""
|
|
set debug 0
|
|
set time 0
|
|
set ts "No file"
|
|
set ::logfd stdout
|
|
set ::loglevel 0
|
|
|
|
# validate parameters
|
|
::detectads::checkopts $argv
|
|
|
|
if {[info exists ::auto::logfile]} {
|
|
set logfile $::auto::logfile
|
|
} else {
|
|
set logfile "/mod/tmp/detectads.log"
|
|
}
|
|
|
|
if {$debug} {
|
|
set loglevel 2
|
|
if {![info exists ::auto::logfd]} {
|
|
set logfd stdout
|
|
}
|
|
puts "DEBUG ON"
|
|
} else {
|
|
# Use same logging option as auto log - mymsman 150515
|
|
set settings [settings]
|
|
set loglevel [$settings _nval_setting "autolog"]
|
|
set logfd [open $logfile "a+"]
|
|
}
|
|
|
|
# process command
|
|
switch -- $opt {
|
|
|
|
-aq { # "Add entry to process queue"
|
|
::detectads::queue $ts $time
|
|
}
|
|
-qq { # "Query if entry on process queue"
|
|
set result [::detectads::query_entry_queue_db $ts]
|
|
log "Query [$ts get file] = $result" 2
|
|
if {$result} {
|
|
puts "Found $result"
|
|
} else {
|
|
puts "Not found"
|
|
}
|
|
return $result
|
|
}
|
|
-dq { # "Delete entry on process queue"
|
|
::detectads::delete_entry_queue_db $ts
|
|
}
|
|
-pr { # Process single file now
|
|
if {[$ts flag "ODEncrypted"]} {
|
|
::detectads::chaserun $ts
|
|
} else {
|
|
::detectads::run $ts
|
|
}
|
|
}
|
|
-rs { # Reset ad-detection flag and bookmarks
|
|
exec hmt "-detectads" "$file"
|
|
exec hmt "+clearbookmarks" "$file"
|
|
}
|
|
-h -
|
|
--help -
|
|
default { # Help
|
|
puts "detectads = Detect ads in recordings and bookmark or crop them"
|
|
puts " "
|
|
puts "detectads -h = produce this help"
|
|
puts "detectads -aq recording ?options? = add recording to request queue"
|
|
puts "detectads -qq recording = query if recording on request queue"
|
|
puts "detectads -dq recording = delete recording from request queue"
|
|
puts "detectads -pr recording ?options? = process recording now"
|
|
puts "detectads -rs recording = reset ad-detection flag and bookmarks"
|
|
puts ""
|
|
puts "Option Default (unless changed in Settings) "
|
|
puts "-d n = produce detailed debug on Stdout "
|
|
puts "-t 0 = -aq only, target start time hh:mm or linux time value"
|
|
puts "-force n = -aq only, don't check if DetectAds flag set"
|
|
puts "-crop n = Crop ad breaks from recording y|n"
|
|
puts "-bmEnd n = Only bookmark end of ad breaks y|n"
|
|
puts "-bmSil n = Bookmark all Silences (for testing) y|n"
|
|
puts "-delOrig n = Delete input file after cropping y|n"
|
|
puts "-tgt = = Target path for cropped output, = means same dir as original"
|
|
puts "-cpuLimit 0 = Limit ffmpeg cpu to n%, 0 no limit, requires cpulimit package"
|
|
puts "-misRdSec 30 = Retry if more than n secs data missing during decryption"
|
|
puts "-misDetSec 5 = Warn if more than n secs data missing during ad detection"
|
|
puts "-misDetAlarm 10 = Webif notification if more than n secs data missing during ad detection"
|
|
puts "-delSec 180 = Delay start of chaserun processing until n seconds after recording begins"
|
|
puts "-retMax 2 = Maximum retry attempts if decryption fails"
|
|
puts "-silDb -70 = How quiet a silence must be to be detected"
|
|
puts "-silMinSec 0.2 = Minimum length a silence must be to be detected in seconds"
|
|
puts "-brkMinCt 5 = Minimum number of silences in ad break "
|
|
puts "-brkMinSec 60 = Minimum length of an ad break in seconds"
|
|
puts "-adMaxSec 65 = Maximum length of a single ad in seconds"
|
|
puts "-padSec 0 = Adjust ends of ad breaks by n seconds"
|
|
puts "-makeThm n = Make thumbnail if it doesn't already exist"
|
|
puts "-thmOffset 0 = Thumbnail offset from programme start"
|
|
puts "-dirDecrypt n = Use software decryption"
|
|
}
|
|
|
|
}
|