Move -inp file handling to chaseget, create /mod/bin/detectads alias

This commit is contained in:
Bob Buxton 2020-07-18 17:03:22 +01:00
parent f03adf60e6
commit 1e3dc9cae7
4 changed files with 18 additions and 17 deletions

View File

@ -1,10 +1,10 @@
Package: detectads
Priority: optional
Section: misc
Version: 0.3.0
Version: 0.3.0-1
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,stripts(>=1.4.5)
Depends: webif(>=1.4.0), chaseget(>=0.1.3), nicesplice(>=1.7), ffmpeg, libsndfile (>=1.0.25-2), procps,stripts(>=1.4.5)
Description: Automatically detects adverts
and inserts bookmarks or deletes adverts. Can run whilst recording is still in progress

View File

@ -1,6 +1,6 @@
#!/bin/sh
## nothing to do
## Set link
ln -f /mod/webif/plugin/detectads/detectads /mod/bin/detectads
exit 0

View File

@ -1,4 +1,5 @@
#!/bin/sh
# nothing to do
# remove program links
rm /mod/bin/detectads
exit 0

View File

@ -14,14 +14,14 @@ proc ::detectads::delete_entry_queue_db {ts} {
#delete ophans that haven't been modified in an hour or are for the current recording
proc ::detectads::delete_orphans {file} {
if {![catch {exec /mod/bin/pgrep -x chaseget }]} {return}
#if {![catch {exec /mod/bin/pgrep -x chaseget }]} {return}
set bname [file rootname [file tail $file]]
set fl [glob -nocomplain "/mod/tmp/*-inp.ts" "/mod/tmp/*-dec.ts"]
log "orphan file list $fl" 2
foreach f $fl {
set fname [file tail [string range $f 0 end-7]]
log "$bname $fname [clock format [file mtime $f]]" 0
log "$bname $fname [clock format [file mtime $f]]" 2
if {[file mtime $f]+3600 < [clock seconds]
|| $bname == $fname} {
safedel $f "/orphans"
@ -706,13 +706,13 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
log "starting" 2
# Create links to input in tmp for retrieval
file delete -force "$ipath/$iname.ts"
catch {file link -hard "$ipath/$iname.ts" "[file normalize [file rootname $file].ts]"}
file delete -force "$ipath/$iname.nts"
catch {file link -hard "$ipath/$iname.nts" "[file normalize [file rootname $file].nts]"}
file delete -force "$ipath/$iname.hmt"
catch {file link -hard "$ipath/$iname.hmt" "[file normalize [file rootname $file].hmt]"}
set its [ts fetch $ifile]
# file delete -force "$ipath/$iname.ts"
# catch {file link -hard "$ipath/$iname.ts" "[file normalize [file rootname $file].ts]"}
# file delete -force "$ipath/$iname.nts"
# catch {file link -hard "$ipath/$iname.nts" "[file normalize [file rootname $file].nts]"}
# file delete -force "$ipath/$iname.hmt"
# catch {file link -hard "$ipath/$iname.hmt" "[file normalize [file rootname $file].hmt]"}
# set its [ts fetch $ifile]
# Use link for .nts so updates are visble
@ -764,10 +764,10 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
if {!$dirdecrypt} {
# Use chaseget for decryption
set decrypt "/mod/bin/chaseget {$ifile} $tfilesize"
set decrypt "/mod/bin/chaseget {$file} $tfilesize"
} else {
# Use stripts for decryption
set decrypt "/mod/bin/stripts -@@ {$ipath/$iname} - 2>@$::logfd"
set decrypt "/mod/bin/stripts -@@ {$file} - 2>@$::logfd"
}
set adDetectOutput [open "|\
@ -946,7 +946,7 @@ proc ::detectads::chaserun {ts {Qid 0} {retrynumb 0}} {
$tts setbookmarks $bookmarks
# Delete links to input from /mod/tmp
$its delete
#its delete
# Check that complete file has been retrieved & detected
set ts [ts fetch $file]