From f116cc5801f4cc7313034b335b56b3f871bb0c7d Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 4 Feb 2013 22:32:21 +0000 Subject: [PATCH] show pending schedule items, auto diskspace check improvements git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1396 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 4 ++-- var/mongoose/html/css/style.css | 5 +++++ var/mongoose/html/sched/sched.jim | 34 +++++++++++++++++++++++++++---- var/mongoose/lib/altrow | 17 ++++++++-------- var/mongoose/lib/bin/auto | 14 ++++++++----- var/mongoose/lib/system.class | 20 ++++++++++++++++++ 6 files changed, 74 insertions(+), 20 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index f8e3dddf..0d235556 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: webif Priority: optional Section: web -Version: 0.11.0-4 +Version: 0.11.0-5 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.6),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.9-1),hmt(>=1.1.10),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05) +Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.6),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.10),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05) Suggests: ffmpeg Description: An evolving web interface for the Humax. diff --git a/var/mongoose/html/css/style.css b/var/mongoose/html/css/style.css index 1fcd6840..6349f6e9 100644 --- a/var/mongoose/html/css/style.css +++ b/var/mongoose/html/css/style.css @@ -235,6 +235,11 @@ pre, .pre color: black; } +.strike +{ + text-decoration: line-through; +} + .greenshade { background: #e4faa8; diff --git a/var/mongoose/html/sched/sched.jim b/var/mongoose/html/sched/sched.jim index 5b70768b..9bb75af0 100755 --- a/var/mongoose/html/sched/sched.jim +++ b/var/mongoose/html/sched/sched.jim @@ -57,7 +57,7 @@ proc eventheader {{table TBL_RESERVATION} note} { } } -proc eventrow {event {table TBL_RESERVATION}} { +proc eventrow {event {table TBL_RESERVATION} {pending 0}} { global svcmap set name [$event name] @@ -65,6 +65,9 @@ proc eventrow {event {table TBL_RESERVATION}} { set attrs "table=$table sid=[$event get ulslot] \ reckind=[$event get ucRecKind] rsvtype=[$event get ersvtype] \ ar=[expr ! [$event padded]]" + if {$pending} { + append attrs " class=\"blueshade strike\"" + } altrow $attrs if {$table eq "pending"} { @@ -151,7 +154,12 @@ proc eventrow {event {table TBL_RESERVATION}} { } puts "" - puts "[clock format [$event get nduration] -format %H:%M]" + set xndur [$event get nduration] + if {$xndur > 0} { + puts "[clock format $xndur -format %H:%M]" + } else { + puts "--:--:--" + } if {[llength $elist] > 1} { puts "
" foreach e $elist { @@ -177,10 +185,22 @@ proc eventfooter {} { puts "" } +proc ekey {event} { + set ret "" + foreach key {ersvtype nsttime nduration hsvc usevtid} { + append ret ".[$event get $key]" + } + return $ret +} + +set pmap {} set events [rsv list pending] if {[llength $events] > 0} { eventheader pending "Pending Scheduled Events" - foreach event $events {eventrow $event pending} + foreach event $events { + eventrow $event pending + lappend pmap [ekey $event] + } eventfooter puts { @@ -193,7 +213,13 @@ if {[llength $events] > 0} { set events [rsv list] eventheader "live" "Scheduled Events" -foreach event $events {eventrow $event} +foreach event $events { + if {[ekey $event] in $pmap} { + eventrow $event TBL_RESERVATION 1 + } else { + eventrow $event + } +} eventfooter puts { diff --git a/var/mongoose/lib/altrow b/var/mongoose/lib/altrow index bf8c5f19..b45dd81e 100644 --- a/var/mongoose/lib/altrow +++ b/var/mongoose/lib/altrow @@ -1,17 +1,16 @@ if {![exists -proc altrow]} { proc altrow {{attrs ""}} {{i 0}} { - puts -nonewline ""; - set i [expr ! $i] } } diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index 77c879f1..24e5ef61 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -59,10 +59,14 @@ if {[system is_listening 9000]} { log "Media scan starting, DLNA server status: $dlnaok" 1 -proc dsc {} { - lassign [system diskspace] size used perc - if {$perc > 90} { - log "Insufficient disk space ($perc% $size/$used), aborting." 1 +proc dsc {{size 0}} { + set free [system diskfree] + + # Required disk space is 10GiB + 4 times the file size. + set req $($size * 4 + 10 * 1073741824) + + if {$free < $req} { + log "Insufficient disk space. Require=$req, Free=$free" 1 exit } } @@ -284,7 +288,6 @@ proc do_mpg {ts} { proc entries {dir callback} { foreach entry [readdir -nocomplain $dir] { - dsc if {![string match {*.ts} $entry} continue if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue if {$ts == 0} continue @@ -292,6 +295,7 @@ proc entries {dir callback} { log "$entry - in use\n" 1 continue } + dsc [file size "$dir/$entry"] $callback $ts } } diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index 99d9aa08..d6a39bb3 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -120,6 +120,26 @@ proc {system diskspace} {} { return [list $size $used $perc $free $fperc $dev] } +proc {system diskfree} {} { + switch [system model] { + HDR { set part /mnt/hd2 } + HD { set part /media/drive1 } + } + + set free 0 + foreach line [split [exec /mod/bin/busybox/df -k $part 2>>/dev/null] "\n\r"] { + if {[string match "/*" $line]} { + regsub -all -- {[[:space:]]+} $line " " line + set fields [split $line] + set free [lindex $fields 3] + set free $($free * 1024) + break + } + } + + return $free +} + proc {system busy} {} { # Is humaxtv doing anything important? if {[catch {set pid [exec /mod/bin/busybox/pgrep humaxtv]}]} {