Merge branch 'decrypt'

This commit is contained in:
Bob Buxton 2020-03-02 22:20:40 +00:00
commit c504629a5d
4 changed files with 30 additions and 14 deletions

View File

@ -4,7 +4,7 @@ Section: misc
Version: 0.3.0
Architecture: mipsel
Maintainer: mymsman (Created by njm)
Depends: webif(>=1.4.0), chaseget(>=0.1.2-1), nicesplice(>=1.7), ffmpeg, libsndfile (>=1.0.25-2), procps
Depends: webif(>=1.4.0), chaseget(>=0.1.2-1), nicesplice(>=1.7), ffmpeg, libsndfile (>=1.0.25-2), procps,stripts(>=1.4.4-1)
Description: Automatically detects adverts
and inserts bookmarks or deletes adverts. Can run whilst recording is still in progress

View File

@ -20,5 +20,6 @@ Option Default (unless changed in Settings)
-brkMinSec 60 = Minimum length of an ad break in seconds
-adMaxSec 65 = Maximum length of a single ad in seconds
-padSec 0 = Adjust ends of ad breaks by n seconds
-makeThm n = Make thumbnail if it doesn't already exist"
-thmOffset 0 = Thumbnail offset from detected programme start"
-makeThm n = Make thumbnail if it doesn't already exist
-thmOffset 0 = Thumbnail offset from detected programme start
-dirDecrypt n = Use software decryption

View File

@ -135,6 +135,7 @@ switch -- $opt {
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"
}
}

View File

@ -152,6 +152,7 @@ proc ::detectads::checkopts {argv} {
brkminsec 60
admaxsec 65
padsec 0
dirdecrypt 0
makethm 0
thmoffset 0}
@ -790,14 +791,16 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
set etime [$ts get end]
set ctime [clock seconds]
# Check file sharing enabled
if {[system param DMS_START_ON]} {
log "Content Sharing Enabled" 2
} else {
puts "Content Sharing Disabled -cannot decrypt files"
log "Content Sharing Disabled" 0
system notify "DetectAds: Contents sharing disabled, Enable via Humax Settings menu"
return {"DEFER" "Content Sharing Disabled"}
if {!$dirdecrypt} {
# Check file sharing enabled
if {[system param DMS_START_ON]} {
log "Content Sharing Enabled" 2
} else {
puts "Content Sharing Disabled -cannot decrypt files"
log "Content Sharing Disabled" 0
system notify "DetectAds: Contents sharing disabled, Enable via Humax Settings menu"
return {"DEFER" "Content Sharing Disabled"}
}
}
@ -847,11 +850,14 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
# Open recording to lock against Auto and Flatten
set recording [open $file r]
if {($stime +$delsec) > $ctime} {
if {!$dirdecrypt} {
if {($stime +$delsec) > $ctime} {
log "Waiting for recording $delsec seconds" 1
sleep $($stime +$delsec- $ctime)
set ctime [clock seconds]
}
}
}
set start [clock milliseconds]
log "starting" 2
@ -906,8 +912,16 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
set newtitle [concat $title "-Decrypt"]
exec hmt "+settitle=${newtitle}" "$tpath/$tname.hmt"
if {!$dirdecrypt} {
# Use chaseget for decryption
set decrypt "/mod/bin/chaseget {$ifile} $tfilesize"
} else {
# Use stripts for decryption
set decrypt "/mod/bin/stripts -@@ -d -d {$ipath/$iname} - 2>@$::logfd"
}
set adDetectOutput [open "|\
/mod/bin/chaseget {$ifile} $tfilesize |\
$decrypt |\
tee -i {$tfile} |\
nice -n 19 ffmpeg -nostats -loglevel fatal -i pipe:0 -vn -sn -ac 2 -f au pipe:1 2>@$::logfd |\
/mod/webif/plugin/detectads/silence $silenceArgs 2>@$::logfd" r]