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
This commit is contained in:
hummypkg 2013-02-04 22:32:21 +00:00
parent 9d75b810c8
commit f116cc5801
6 changed files with 74 additions and 20 deletions

View File

@ -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.

View File

@ -235,6 +235,11 @@ pre, .pre
color: black;
}
.strike
{
text-decoration: line-through;
}
.greenshade
{
background: #e4faa8;

View File

@ -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 "</td><td align=center>"
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 "<div class=also style=\"margin-top: 0.5em\">"
foreach e $elist {
@ -177,10 +185,22 @@ proc eventfooter {} {
puts "</tbody></table></fieldset>"
}
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 {
<small>
@ -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 {

View File

@ -1,17 +1,16 @@
if {![exists -proc altrow]} {
proc altrow {{attrs ""}} {{i 0}} {
puts -nonewline "<tr class="
if { $i == 0 } {
puts -nonewline "odd"
} else {
puts -nonewline "even"
puts -nonewline "<tr"
if {[string first "class=" $attrs] == -1} {
case $i {
0 { puts -nonewline " class=odd" }
1 { puts -nonewline " class=even" }
}
if {$attrs ne ""} {
puts -nonewline " $attrs"
}
puts ">";
set i [expr ! $i]
}
if {$attrs ne ""} { puts -nonewline " $attrs" }
puts ">";
}
}

View File

@ -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
}
}

View File

@ -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]}]} {