From 492b37be4195c93518fe7c805198dd08bcef3250 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sat, 14 Jun 2014 09:21:09 +0000 Subject: [PATCH] 1.0.15 & improved status git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1968 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/cgi-bin/status.jim | 90 ++++++++++++++++++++++++++++++---------- 2 files changed, 68 insertions(+), 24 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 36135f8..c58a130 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.0.14-10 +Version: 1.0.15 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.19),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose diff --git a/webif/cgi-bin/status.jim b/webif/cgi-bin/status.jim index 64aad8b..4898302 100755 --- a/webif/cgi-bin/status.jim +++ b/webif/cgi-bin/status.jim @@ -19,6 +19,12 @@ switch $runmode { } } +if {"-d" in $argv} { + proc debug {arg} { puts $arg } +} else { + proc debug {arg} {} +} + if {[catch {set pid [exec pgrep -n humaxtv]}]} { puts "Cannot find humaxtv process." exit @@ -54,6 +60,9 @@ proc get_data {} { [string first /media/ $line] == -1} { continue } + if {[string first "/.tsr/" $line] != -1} { + continue + } regsub -- { \([^\)]+\)$} $line "" line set ext [file extension $line] if {$ext ni $exts} continue @@ -79,7 +88,6 @@ proc get_data {} { set play 0 set rec 0 -set seen {} set output {} set data {} @@ -87,33 +95,69 @@ if {$type eq "full"} { set data [get_data] } if {[llength $data]} { - sleep 3 - set ndata [get_data] -# puts " DATA: ($data)" -# puts " NDATA: ($ndata)" - foreach file [array names ndata] { + debug " DATA: ($data)" + if {![file exists /tmp/.rractive]} { + set rr 0 + sleep 3 + set ndata [get_data] + debug " NDATA: ($ndata)" + } else { + set rr 1 + set recs {} + loop i 0 2 { + catch { + set fd [open "/tmp/.rec$i" r] + lappend recs "[$fd read -nonewline].ts" + $fd close + } + } + debug " RECS: $recs" + } + foreach file [array names data] { set bname [file rootname [file tail $file]] - if {![dict exists $seen $file]} { set seen($file) 0 } - if {![dict exists $data $file]} { set data($file) 0 } + if {[file exists "/mod/tmp/webif_auto/decrypting.$bname.ts"]} { - set mode "Decrypting" - set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\"" - } elseif {$ndata($file) == -1} { - incr rec - incr play - set mode "Chase Playing" - set icon "745_1_11_Video_3REC_Live.png" - } elseif {$ndata($file) > $data($file) && $seen($file) < 1} { - incr rec - set mode "Recording" - set icon "745_1_11_Video_1REC.png" + set mode dec + } elseif {$data($file) == -1} { + set mode chase + } elseif {$rr} { + if {$file in $recs} { + set mode rec + } else { + set mode play + } } else { - incr play - set mode "Playing" - set icon "745_1_10_Video_2Live.png" + if {![dict exists $ndata $file]} continue + if {$ndata($file) > $data($file)} { + set mode rec + } else { + set mode play + } } - incr seen($file) + switch $mode { + chase { + incr rec + incr play + set mode "Chase Playing" + set icon "745_1_11_Video_3REC_Live.png" + } + rec { + incr rec + set mode "Recording" + set icon "745_1_11_Video_1REC.png" + } + play { + incr play + set mode "Playing" + set icon "745_1_10_Video_2Live.png" + } + dec { + set mode "Decrypting" + set icon "178_1_00_Icon_Lock.png " + append icon "style=\"padding: 0 0.2em 0 0.5em\"" + } + } set name [string map { "/mnt/hd2/My Video/" ""