Initial version 0.1.0-0
This commit is contained in:
commit
3fa0fdb87d
|
@ -0,0 +1,10 @@
|
|||
Package: chasedecrypt
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 0.1.0-0
|
||||
Architecture: mipsel
|
||||
Maintainer: mymsman
|
||||
Depends: webif(>=1.4.0), chaseget(>=0.1.1-6), procps
|
||||
Description: Decrypts recordings whilst recording is still in progress
|
||||
|
||||
Tags: http://wiki.hummy.tv/wiki/ChaseDecrypt
|
|
@ -0,0 +1,50 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
source /mod/webif/plugin/chasedecrypt/chasedecrypt.jim
|
||||
require lock system.class ts.class pretty_size browse.class \
|
||||
safe_delete settings.class plugin
|
||||
|
||||
set logfile "/mod/tmp/chasedecrypt.log"
|
||||
set settings [settings]
|
||||
if {[lindex $argv 0] eq "-d"} {
|
||||
set argv [lrange $argv 1 end]
|
||||
set loglevel 2
|
||||
set logfd stdout
|
||||
puts "DEBUG ON"
|
||||
} else {
|
||||
set loglevel [$settings _nval_setting "autolog"]
|
||||
set logfd [open $logfile "a+"]
|
||||
}
|
||||
|
||||
proc log {msg {level 1}} {
|
||||
if {$level > $::loglevel} return
|
||||
puts $::logfd "[\
|
||||
clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S"\
|
||||
] RM([pid])- $msg"
|
||||
flush $::logfd
|
||||
}
|
||||
|
||||
|
||||
set settings [settings]
|
||||
if {[lindex $argv 0] eq "-d"} {
|
||||
set argv [lrange $argv 1 end]
|
||||
set loglevel 2
|
||||
puts "DEBUG ON"
|
||||
} else {
|
||||
set loglevel [$settings _nval_setting "autolog"]
|
||||
}
|
||||
|
||||
if {[lindex $argv 0] ne "-start"} {
|
||||
exit
|
||||
}
|
||||
|
||||
log "Recmon: $argv" 2
|
||||
|
||||
set file [lindex $argv 1]
|
||||
set ts [ts fetch "$file.ts"]
|
||||
::chasedecrypt::chancheck $ts
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
# Override options must be specified on the first line of this file above
|
||||
Option Default (unless changed in Settings)
|
||||
-d = produce detailed debug on Stdout
|
||||
-delSec 180 = Delay start of chaserun processing until n seconds after recording begins
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
.contextMenu li.chasedecrypt a
|
||||
{
|
||||
background-image: url(/plugin/chasedecrypt/img/chasedecrypt.png);
|
||||
background-size: 16px 16px;
|
||||
}
|
||||
.contextMenu li.editchasedecrypt a
|
||||
{
|
||||
background-image: url(/plugin/chasedecrypt/img/edit.png);
|
||||
background-size: 16px 16px;
|
||||
}
|
||||
|
||||
|
||||
.contextMenu li.nochasedecrypt a
|
||||
{
|
||||
background-image: url(/plugin/chasedecrypt/img/nochasedecrypt.png);
|
||||
background-size: 16px 16px;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
jscss /plugin/chasedecrypt/browse.js /plugin/chasedecrypt/browse.css
|
||||
|
||||
|
||||
#lappend plugins(menu) {chasedecrypt {desc "Detect Adverts"}}
|
||||
|
||||
lappend plugins(dmenu) {chasedecrypt {desc "Toggle ChaseDecrypt"}}
|
||||
#lappend plugins(dmenu) {editchasedecrypt {desc "Edit ChaseDecrypt options"}}
|
||||
#lappend plugins(dmenu) {nochasedecrypt {desc "Toggle No ChaseDecrypt"}}
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
//plugins.menu.chasedecrypt = function(file) {
|
||||
// window.location = '/plugin/chasedecrypt/web/?file=' + file;
|
||||
//
|
||||
|
||||
plugins.dmenu.chasedecrypt = function(dir, iconset, results, el) {
|
||||
flagdir(dir, 'chasedecrypt', iconset, results, el);
|
||||
};
|
||||
|
||||
//plugins.dmenu.editchasedecrypt = function(dir, iconset, results, el) {
|
||||
// var edir = encodeURIComponent(dir);
|
||||
// cf = dir + '/.chasedecrypt';
|
||||
// curloc = window.location;
|
||||
// $(results).slideDown().load('/plugin/chasedecrypt/editprep.jim',
|
||||
// {file: cf}, function() {
|
||||
// window.location = '/edit/edit.jim' +
|
||||
// '?file=' + encodeURIComponent(cf) +
|
||||
// '&backdesc=Back to media browser' +
|
||||
// '&backlink=' + encodeURIComponent(curloc);
|
||||
// }).delay(300).slideUp();
|
||||
//};
|
||||
|
||||
|
||||
plugins.dmenu_prepare.chasedecrypt = function(el, menu) {
|
||||
fixdmenu(el, menu, 'chasedecrypt', '#chasedecrypt', 'ChaseDecrypt', 0);
|
||||
};
|
||||
|
||||
//plugins.dmenu_prepare.editchasedecrypt = function(el, menu) {
|
||||
// if ($(el).attr('chasedecrypt') == '1') {
|
||||
//
|
||||
// $(menu).enableContextMenuItems('#editchasedecrypt');
|
||||
// //$(menu).showContextMenuItems('#editchasedecrypt');
|
||||
// } else {
|
||||
// $(menu).disableContextMenuItems('#editchasedecrypt');
|
||||
// //$(menu).hideContextMenuItems('#editchasedecrypt');
|
||||
// }
|
||||
//};
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
proc ::chasedecrypt::delete_orphans {} {
|
||||
if {![catch {exec /mod/bin/pgrep -x chaseget }]} {return}
|
||||
set fl [glob -nocomplain "/mod/tmp/*-inp.ts" "/mod/tmp/*-dec.ts"]
|
||||
log "orphan file list $fl" 2
|
||||
foreach file $fl {
|
||||
if {![system inuse $file]} {
|
||||
set bname [file rootname $file]
|
||||
file delete -force $bname.hmt
|
||||
file delete -force $bname.nts
|
||||
file delete -force $file
|
||||
log "Deleted orphan file $file"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Parse command options and apply defaults
|
||||
proc ::chasedecrypt::checkopts {argv} {
|
||||
|
||||
set ::optlist ""
|
||||
set ::opt "-h"
|
||||
set ::debug 0
|
||||
set parmerror 0
|
||||
|
||||
set settings [settings]
|
||||
|
||||
set ::autologlevel [$settings _nval_setting "autolog"]
|
||||
|
||||
# List of options with default values
|
||||
set optarray {
|
||||
delorig 0
|
||||
misrdsec 0
|
||||
delsec 210 }
|
||||
|
||||
# Override default from settings DB
|
||||
foreach {key defvalue} [array get optarray] {
|
||||
set ::opts($key) [$settings _nval_setting "chasedecrypt_$key"]
|
||||
if {$::opts($key)==0} {set ::opts($key) $defvalue}
|
||||
}
|
||||
|
||||
# Handle text setting for oher options
|
||||
set otheropts [$settings _tval_setting "chasedecrypt_otheropts"]
|
||||
|
||||
# Parse argument lists
|
||||
foreach argl [list $otheropts $argv] {
|
||||
#set ::optlist ""
|
||||
log "arg list $argl" 2
|
||||
for {set ix 0} {$ix < [llength $argl]} {incr ix} {
|
||||
set arg [lindex $argl $ix]
|
||||
|
||||
#check if option in optarray list
|
||||
if {[string range $arg 0 0] == "-"} {
|
||||
set argx [string tolower [string range $arg 1 end]]
|
||||
if {[dict exists $optarray $argx]} {
|
||||
incr ix
|
||||
set val [lindex $argl $ix]
|
||||
set nval $val
|
||||
if {$val eq "y"} {set nval 1}
|
||||
if {$val eq "n"} {set nval 0}
|
||||
if {![string is double -strict $nval]} {
|
||||
log "Option $arg value ($val) is not y, n or numeric" 0
|
||||
incr ix -1
|
||||
set parmerror 1
|
||||
continue
|
||||
}
|
||||
lappend ::optlist $arg
|
||||
lappend ::optlist $val
|
||||
set ::opts($argx) $nval
|
||||
#puts "found -$argx value $val"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
# check other options
|
||||
switch -- $arg {
|
||||
|
||||
-debug -
|
||||
-d {
|
||||
set ::debug 1
|
||||
set ::loglevel 2
|
||||
set ::auto::loglevel 2
|
||||
lappend ::optlist $arg
|
||||
}
|
||||
|
||||
|
||||
default {
|
||||
log "Unrecognized option: $arg" 0
|
||||
set parmerror 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if {$parmerror} {
|
||||
log "Parameter errors found"
|
||||
exit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
proc ::chasedecrypt::chancheck {ts} {
|
||||
# Check recording channel against inclusion list prior to queueing for analysis
|
||||
set file [$ts get file]
|
||||
set channel [$ts get channel_name]
|
||||
|
||||
log " ChaseDecrypt: Checking $file ($channel) for inclusion" 0
|
||||
|
||||
set dir [file dirname $file]
|
||||
#if {[file exists "$dir/.autonochasedecrypt"]} {
|
||||
# log " ChaseDecrypt: No Ad-detection folder flag set $file" 0
|
||||
# return 0
|
||||
#}
|
||||
|
||||
if {![$ts flag "ODEncrypted"]} {
|
||||
log " ChaseDecrypt: Already decrypted $file" 0
|
||||
return 0
|
||||
}
|
||||
|
||||
# ignore FlatView directory
|
||||
set settings [settings]
|
||||
set fvdir [$settings _tval_setting "fv_dir"]
|
||||
|
||||
if {[file tail $dir] == $fvdir} {
|
||||
log " ChaseDecrypt: Flat view directory, skipping $file" 0
|
||||
return 0
|
||||
}
|
||||
|
||||
set decOK 0
|
||||
set opts ""
|
||||
if {![file exists "$dir/.chasedecrypt"]} {
|
||||
# open and read configuration file
|
||||
set cf "/mod/etc/chasedecrypt.conf"
|
||||
|
||||
if {![file exists $cf]} {
|
||||
file copy /mod/webif/plugin/chasedecrypt/default.conf $cf
|
||||
}
|
||||
|
||||
if {![catch {set fp [open $cf r]}]} {
|
||||
set clist [split [read $fp] "\n"]
|
||||
} else {
|
||||
set clist {}
|
||||
}
|
||||
|
||||
# Match channel against exclusion list
|
||||
foreach chan $clist {
|
||||
if {![string length $chan]} continue
|
||||
log "Checking exclusion entry: $chan" 2
|
||||
if {[string match -nocase $chan $channel]} {
|
||||
log "Matched inclusion entry $chan" 0
|
||||
set decOK 1
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Read options from .chasedecrypt file
|
||||
set decOK 1
|
||||
set ado_file "$dir/.chasedecrypt"
|
||||
set hand [open $ado_file]
|
||||
set opts [gets $hand]
|
||||
close $hand
|
||||
}
|
||||
|
||||
::chasedecrypt::checkopts $opts
|
||||
|
||||
if {$decOK} {
|
||||
::chasedecrypt::chaserun $ts
|
||||
} else {
|
||||
log " ChaseDecrypt: $file not eligible for chase decryption" 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc ::chasedecrypt::chaserun {ts} {
|
||||
# run decryption against currently recording program using dlna helper
|
||||
set file [$ts get file]
|
||||
|
||||
log "==ChaseDecrypt Chase Run: $file $::optlist" 0
|
||||
set retcode "OK"
|
||||
set retmsg "Unknown = check log"
|
||||
set qtime 0
|
||||
set warning ""
|
||||
set cropcmd " "
|
||||
|
||||
# Check for and delete any oprhaned files
|
||||
::chasedecrypt::delete_orphans
|
||||
|
||||
set statustok [system startop -multiple chasedecrypt $file]
|
||||
set size [$ts size]
|
||||
set numAdBreaks 0
|
||||
|
||||
# set each option from settings/overrides
|
||||
foreach {key value} [array get ::opts] {
|
||||
set $key $value
|
||||
}
|
||||
|
||||
set stime [$ts get start]
|
||||
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
|
||||
return {"FAILED" "Content Sharing Disabled"}
|
||||
}
|
||||
|
||||
set bname [file rootname [file tail $file]]
|
||||
set iname "$bname-inp"
|
||||
set tname "$bname-dec"
|
||||
set bpath [file dirname $file]
|
||||
set tpath $bpath
|
||||
set ipath "/mod/tmp"
|
||||
#set tpath "/mod/tmp"
|
||||
set bfile "$file"
|
||||
set ifile "$ipath/$iname.ts"
|
||||
set tfile "$tpath/$tname.ts"
|
||||
set status [$ts get status]
|
||||
|
||||
# Open recording to lock against Auto and Flatten
|
||||
set recording [open $file r]
|
||||
if {($stime +$delsec) > $ctime} {
|
||||
log "Waiting for recording $delsec seconds" 1
|
||||
sleep $($stime +$delsec- $ctime)
|
||||
set ctime [clock seconds]
|
||||
}
|
||||
|
||||
if {![acquire_lock $file]} {
|
||||
log "Cannot acquire exclusive lock $file, terminating." 0
|
||||
return {"DEFER" "Cannot acquire exclusive lock"}
|
||||
}
|
||||
|
||||
set start [clock milliseconds]
|
||||
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]
|
||||
|
||||
|
||||
# Use link for .nts so updates are visble
|
||||
file delete -force "$tpath/$tname.nts"
|
||||
catch {file link -hard "$tpath/$tname.nts" "[file normalize [file rootname $file].nts]"}
|
||||
|
||||
# Copy sidecar files and update program title, encryption flag
|
||||
file copy -force "[file rootname $file].hmt" "$tpath/$tname.hmt"
|
||||
# Update output hmt to valid, decrypted, ad-detected empty file
|
||||
set title [$ts get title]
|
||||
set guidance [$ts get guidance]
|
||||
exec hmt "-encrypted" "$tpath/$tname.hmt"
|
||||
exec hmt "-protect" "$tpath/$tname.hmt"
|
||||
exec hmt "+patch8=0x28c:2" "$tpath/$tname.hmt"
|
||||
|
||||
set ftime [clock format $stime -format "%Y%m%d%H%M.%S"]
|
||||
exec touch $tfile -t $ftime
|
||||
set tts [ts fetch $tfile]
|
||||
#set tfilesize [file size $tfile] ;# Restart point
|
||||
set tfilesize 0 ;# Silence/nsplice cant handle restart midway so force total file retrieval
|
||||
|
||||
set newtitle [concat $title "-Decrypt"]
|
||||
exec hmt "+settitle=${newtitle}" "$tpath/$tname.hmt"
|
||||
|
||||
exec /mod/bin/chaseget $ifile $tfilesize > $tfile
|
||||
|
||||
# Delete links to input from /mod/tmp
|
||||
$its delete
|
||||
|
||||
# Check that complete file has been retrieved & detected
|
||||
set ts [ts fetch $file]
|
||||
set tfilesize [file size $tfile]
|
||||
set filesize [file size $file]
|
||||
set missing $($filesize -$tfilesize)
|
||||
set lengtherr 0
|
||||
set stime [$ts get start]
|
||||
set etime [$ts get end]
|
||||
set durn $($etime-$stime)
|
||||
set misstime $(round(abs($missing)/($filesize/$durn)))
|
||||
|
||||
# Recopy hmt to get completion details
|
||||
file copy -force "[file rootname $file].hmt" "$tpath/$tname.hmt"
|
||||
# Update output hmt to valid, decrypted, nonprotected file
|
||||
exec hmt "-encrypted" "$tpath/$tname.hmt"
|
||||
exec hmt "-protect" "$tpath/$tname.hmt"
|
||||
exec hmt "+settitle=${newtitle}" "$tpath/$tname.hmt"
|
||||
|
||||
set newtitle $title
|
||||
if {$missing != 0} {
|
||||
# Length error in decryption
|
||||
set lengtherr 1
|
||||
set warning "Incomplete data retrieval $missing bytes missing ([clock format $misstime -format %T])"
|
||||
log "$file $warning" 0
|
||||
set newtitle "$title -Len err ([clock format $misstime -format %T])"
|
||||
exec hmt "+settitle=$newtitle" "$tpath/$tname.hmt"
|
||||
if {$misstime >= $misrdsec} {
|
||||
# system notify "ChaseDecrypt $file $warning"
|
||||
} else {
|
||||
# ignore the problem
|
||||
set lengtherr 0
|
||||
}
|
||||
}
|
||||
|
||||
if {$lengtherr == 0} {
|
||||
# All OK (as far as we can tell)
|
||||
close $recording
|
||||
|
||||
if {$delorig && ![system inuse $file]} { # Delete original file no longer wanted
|
||||
if {$delorig == 2} {
|
||||
set del [$ts delete]
|
||||
log "file $file deleted, code $del" 1
|
||||
} else {
|
||||
set del [safe_delete $file chasedecrypt]
|
||||
log "$file dustbinned, code $del" 2
|
||||
}
|
||||
if {$del && ![system inuse $tfile]} { # Rename decrypt file to original if not in use
|
||||
exec hmt "+settitle=$newtitle" "$tpath/$tname.hmt"
|
||||
ts renamegroup "$tpath/$tname.ts" "$bname"
|
||||
log "$tname renamed $bname" 1
|
||||
}
|
||||
} else { # Keeping original, dont rename
|
||||
}
|
||||
} else {
|
||||
# Somethings amiss with file length, keep original and delete -dec
|
||||
if {![system inuse $tfile]} {
|
||||
[safe_delete $tfile chasedecrypt]
|
||||
log "$tfile dustbinned" 2
|
||||
}
|
||||
close $recording
|
||||
}
|
||||
|
||||
#set elapsedSeconds [elapsed $start]
|
||||
#set elapsedTime [clock format $(round($elapsedSeconds)) -format "%H:%M:%S"]
|
||||
#log "done...processed $file in ${elapsedSeconds}s $elapsedTime " 0
|
||||
log "done...processed $file" 0
|
||||
|
||||
system endop $statustok
|
||||
release_lock $file
|
||||
log "=============================================================" 1
|
||||
return
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
if {[file exists "$dir/.chasedecrypt"]} {
|
||||
lappend icons [_addicon "/plugin/chasedecrypt/img/chasedecrypt.png" "ChaseDecrypt"]
|
||||
lappend attrs "chasedecrypt=1"
|
||||
}
|
||||
|
||||
#if {[file exists "$dir/.nochasedecrypt"]} {
|
||||
# lappend icons [_addicon "/plugin/chasedecrypt/img/nochasedecrypt.png" "No ChaseDecrypt"]
|
||||
# lappend attrs "nochasedecrypt=1"
|
||||
#}
|
|
@ -0,0 +1,26 @@
|
|||
#!/mod/bin/jimsh
|
||||
# frontend edit/edit/jim to ensure file is editable
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
httpheader
|
||||
|
||||
set file [cgi_get file .temp]
|
||||
puts "Prep file $file"
|
||||
|
||||
set fileok 0
|
||||
if {[file exists "$file"] } {
|
||||
set hand [open $file]
|
||||
set data [read $hand 20]
|
||||
#puts "data $data"
|
||||
if {[string length $data] > 0} { set fileok 1}
|
||||
close $hand
|
||||
}
|
||||
|
||||
if {! $fileok} {
|
||||
file copy -force [file tail $file] $file
|
||||
puts 'Initialized $file'
|
||||
}
|
||||
|
||||
#cd /mod/webif/html/edit
|
||||
#puts [exec /mod/webif/html/edit/edit.jim]
|
|
@ -0,0 +1,18 @@
|
|||
# Icon name / icon
|
||||
lappend plugins(icons) "chasedecrypt"
|
||||
lappend plugins(icons) [_addicon "/plugin/chasedecrypt/img/chasedecrypt.png" "Chase Decryption"]
|
||||
|
||||
|
||||
# Directory tree column - see jqGrid documentation for column options
|
||||
lappend plugins(dircolumn) {
|
||||
{ name:'chasedecrypt',
|
||||
hidden:false, width:22,
|
||||
stype: 'select',
|
||||
searchoptions: {value: {1:"ChaseDecrypt",0:"No ChaseDecrypt",'':"- All"}, searchOperMenu: false, clearSearch: false},
|
||||
label: icons.chasedecrypt + ' ChaseDecrypt',
|
||||
formatter: fmtIcon, formatoptions: {img: icons.chasedecrypt}
|
||||
},
|
||||
}
|
||||
|
||||
# Map browse context menu attributes to flexview column
|
||||
lappend plugins(dmenuattr) "chasedecrypt" "chasedecrypt"
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 782 B |
Binary file not shown.
After Width: | Height: | Size: 536 B |
Binary file not shown.
After Width: | Height: | Size: 814 B |
|
@ -0,0 +1,18 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require settings.class
|
||||
|
||||
httpheader
|
||||
|
||||
|
||||
set delorig [cgi_get chasedecrypt_delorig 0]
|
||||
set otheropts [cgi_get chasedecrypt_otheropts ""]
|
||||
|
||||
[settings new] _nval_setting "chasedecrypt_delorig" $delorig
|
||||
|
||||
[settings new] _tval_setting "chasedecrypt_otheropts" $otheropts
|
||||
|
||||
puts "Settings saved."
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
# cloned from channeldel package - mymsman 150331
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
set cf "/mod/etc/chasedecrypt.conf"
|
||||
|
||||
httpheader
|
||||
|
||||
set clist [cgi_get clist ""]
|
||||
|
||||
if {![string length $clist]} {
|
||||
set clist " "
|
||||
}
|
||||
|
||||
if {[catch {set fp [open $cf w]} msg]} {
|
||||
puts "ERROR: $msg"
|
||||
exit
|
||||
}
|
||||
|
||||
foreach line [split $clist "\n"] {
|
||||
# Strip leading and trailing whitespace
|
||||
regsub -all -- {^[[:space:]]+} $line "" line
|
||||
regsub -all -- {[[:space:]]+$} $line "" line
|
||||
if {![string length $line]} continue
|
||||
puts $fp $line
|
||||
}
|
||||
$fp close
|
||||
|
||||
puts "Chasedecrypt channel list saved successfully."
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#source /mod/webif/lib/setup
|
||||
#require settings.class
|
||||
#set settings [settings]
|
||||
|
||||
set ::chasedecrypt::delorig [$settings _nval_setting "chasedecrypt_delorig"]
|
||||
|
||||
set ::chasedecrypt::otheropts [$settings _tval_setting "chasedecrypt_otheropts"]
|
||||
if {$::chasedecrypt::otheropts == 0} {set ::chasedecrypt::otheropts ""}
|
||||
|
||||
puts "
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend>
|
||||
<a href=\"http://wiki.hummy.tv/wiki/ChaseDecrypt\" target=\"_blank\"><img src=\"/plugin/chasedecrypt/img/chasedecrypt.png\" alt=\"ChaseDecrypt icon\"/> Chase decrypt recording</a>
|
||||
</legend>
|
||||
<p>See <b><a href=\"http://wiki.hummy.tv/wiki/ChaseDecrypt\" target=\"_blank\">ChaseDecrypt user guide</a></b> for help</p>
|
||||
<form class=auto id=chasedecrypt method=get
|
||||
action=/plugin/chasedecrypt/save.jim>
|
||||
<table>"
|
||||
puts "
|
||||
<!-- Channel inclusion based on ChannelDel package
|
||||
-->
|
||||
<tr>
|
||||
<th class=key>Select channels for Chase decryption
|
||||
</th>
|
||||
|
||||
<td><button id=chasedecrypt_incl type=button>Edit list</button>
|
||||
</td>
|
||||
</tr>"
|
||||
|
||||
puts "
|
||||
<tr id=chasedecrypt_delorig class=dahide>
|
||||
<th class=key>Original recording
|
||||
</th>
|
||||
<td><input name=chasedecrypt_delorig
|
||||
type=radio value=0"
|
||||
if {$::chasedecrypt::delorig eq 0} { puts -nonewline " checked" }
|
||||
puts "> Keep
|
||||
</td>
|
||||
<td><input name=chasedecrypt_delorig
|
||||
type=radio value=1"
|
||||
if {$::chasedecrypt::delorig eq 1} { puts -nonewline " checked" }
|
||||
puts "> Move to bin
|
||||
</td>
|
||||
<td><input name=chasedecrypt_delorig
|
||||
type=radio value=2"
|
||||
if {$::chasedecrypt::delorig eq 2} { puts -nonewline " checked" }
|
||||
puts "> Delete
|
||||
</td>
|
||||
</tr>"
|
||||
puts "
|
||||
<tr>
|
||||
<th class=key><a href=\"http://wiki.hummy.tv/wiki/ChaseDecrypt#Options\" target=\"_blank\">Other options</a>
|
||||
</th>
|
||||
<td colspan=4><input id=chasedecrypt_otheropts name=chasedecrypt_otheropts
|
||||
class=\"ui-widget-content ui-corner-all\"
|
||||
type=text size=100 value=\"$::chasedecrypt::otheropts\">
|
||||
</td>
|
||||
</tr>"
|
||||
puts "
|
||||
<tr>
|
||||
<td colspan=2><input type=submit value=\"Update settings\">
|
||||
<div id=chasedecrypt_output></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
"
|
||||
puts {
|
||||
<!-- Channel inclusion based on ChannelDel package
|
||||
-->
|
||||
<script>
|
||||
$('#chasedecrypt_incl').button().click(function() {
|
||||
window.location.href = '/plugin/chasedecrypt/settings.jim';
|
||||
})
|
||||
</script>
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class epg.class
|
||||
|
||||
jqplugin form
|
||||
jscss settings.js style.css
|
||||
header
|
||||
|
||||
# cloned from channeldel package - mymsman 150331
|
||||
set cf "/mod/etc/chasedecrypt.conf"
|
||||
|
||||
if {![file exists $cf]} {
|
||||
file copy /mod/webif/plugin/chasedecrypt/default.conf $cf
|
||||
}
|
||||
|
||||
|
||||
if {![catch {set fp [open $cf r]}]} {
|
||||
set clist [split [read $fp] "\n"]
|
||||
} else {
|
||||
set clist {}
|
||||
}
|
||||
|
||||
set channels {}
|
||||
lmap i [$channeldb query "
|
||||
select usLcn, szSvcName
|
||||
from TBL_SVC
|
||||
"] { set channels([lindex $i 1]) [string range [lindex $i 3] 1 end] }
|
||||
|
||||
puts {
|
||||
<fieldset id=chasedecrypt width=100%>
|
||||
<legend><a href="http://wiki.hummy.tv/wiki/ChaseDecrypt" target=\"_blank\"><img src="/plugin/chasedecrypt/img/chasedecrypt.png" alt="ChaseDecrypt icon"/> ChaseDecrypt Channel Inclusion Settings</a></legend>
|
||||
|
||||
<p>See <b><a href="http://wiki.hummy.tv/wiki/ChaseDecrypt" target=\"_blank\">ChaseDecrypt user guide</a></b> for help</p>
|
||||
<form method=post action=savelist.jim id=excsave>
|
||||
<button id=save type=submit>Save Changes</button>
|
||||
<button id=back type=button>Return to settings</button>
|
||||
<div id=saveresults class=blood
|
||||
style="float: left; font-style: italic; padding: 0.5em 1em"></div>
|
||||
|
||||
<div class=col style="clear: left" id=autoexc>
|
||||
Include channels
|
||||
(Wildcards are supported using *)
|
||||
}
|
||||
puts -nonewline "<textarea name=clist id=exclist rows=40 cols=20
|
||||
class=\"ui-widget ui-corner-all\">"
|
||||
foreach chan $clist {
|
||||
if {![string length $chan]} continue
|
||||
puts $chan
|
||||
}
|
||||
puts {</textarea>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class=ocol id=Add>
|
||||
<button class=move><img class=arrow src=/img/left.png></button>
|
||||
</div>
|
||||
|
||||
<div class=col id=channels>
|
||||
Channels
|
||||
}
|
||||
puts "
|
||||
<select id=chanlist name=chanlist size=[expr [llength $channels] / 2]
|
||||
class=\"chanlist ui-widget-content ui-corner-all\"
|
||||
multiple=multiple>
|
||||
"
|
||||
foreach lcn [lsort -integer [array names channels]] {
|
||||
if {$lcn == 0} continue
|
||||
if {$channels($lcn) in $clist} continue
|
||||
set flag 0
|
||||
catch {
|
||||
foreach c $clist {
|
||||
if {[string match -nocase $c $channels($lcn)]} {
|
||||
set flag 1
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$flag} continue
|
||||
puts "<option value=\"$channels($lcn)\">$lcn - $channels($lcn)"
|
||||
}
|
||||
puts {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
footer
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
$(function() {
|
||||
|
||||
// cloned from channeldel package - mymsman 150331
|
||||
|
||||
$('#back').button({
|
||||
icons : {
|
||||
primary : "ui-icon-arrowreturnthick-1-w"
|
||||
}
|
||||
}).on('click', function() {
|
||||
window.location = '/settings/settings.jim'
|
||||
});
|
||||
|
||||
|
||||
$('.move').button().click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('#chanlist' + ' option:selected').each(function() {
|
||||
var box = $('#exclist');
|
||||
box.val(box.val() + $.trim($(this).val()) + '\n');
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
$('#excsave').ajaxForm({
|
||||
target: '#saveresults',
|
||||
success: function() {
|
||||
$('#saveresults')
|
||||
.css('font-style', 'italic')
|
||||
.show('slow')
|
||||
.delay(2000)
|
||||
.fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
$('#save').button();
|
||||
|
||||
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
register_statusop chasedecrypt "Chase Decrypting-" "/plugin/chasedecrypt/img/chasedecrypt.png"
|
||||
#Based on
|
||||
# Icon by Ivan Boyko https://www.iconfinder.com/icons/310307/running_sport_icon
|
||||
# Creative Commons (Attribution 3.0 Unported) https://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
div.col, div.ocol
|
||||
{
|
||||
float: left;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#save
|
||||
{
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.col
|
||||
{
|
||||
border: 1px solid grey;
|
||||
width: 20%;
|
||||
}
|
||||
div.ocol
|
||||
{
|
||||
border: 0;
|
||||
width: 5%;
|
||||
}
|
||||
select.chanlist
|
||||
{
|
||||
multiple: multiple;
|
||||
width: 100%
|
||||
}
|
||||
img.arrow
|
||||
{
|
||||
border: 0;
|
||||
height: 20px;
|
||||
}
|
||||
button
|
||||
{
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
Loading…
Reference in New Issue