From 5f6c7a843c2d3647e7b98c50f3676c96fc7f3147 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 5 Jul 2011 00:19:02 +0000 Subject: [PATCH] new reservations screen git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@234 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/include/sched.jim | 132 ++++++++++++++++++++------------- var/mongoose/lib/rsv.class | 74 ++++++++++++++++++ 2 files changed, 155 insertions(+), 51 deletions(-) create mode 100755 var/mongoose/lib/rsv.class diff --git a/var/mongoose/include/sched.jim b/var/mongoose/include/sched.jim index 107f50da..025be02a 100755 --- a/var/mongoose/include/sched.jim +++ b/var/mongoose/include/sched.jim @@ -1,46 +1,33 @@ #!/mod/bin/jimsh -package require sqlite3 - source /mod/var/mongoose/lib/setup -require altrow +require altrow rsv.class progressbar -set db [sqlite3.open /var/lib/humaxtv/rsv.db] -$db query {attach database '/var/lib/humaxtv/channel.db' as channel} +set events [rsv list] -set res [$db query { - select *, channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn, - case when ersvtype > 3 then 1 else 0 end as sort - from tbl_reservation - left join channel.TBL_SVC - on main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc - order by sort, nsttime - }] +puts { + + + + + + + + + + +} -puts "
ChannelProgrammeStart TimeDurationModeEvent/Series IDEvents
" -puts "" -#puts "" -puts "" -puts "" -puts "" -puts "" -puts "" -puts "" -puts "" -foreach r $res { - set name [string range $r(szevtname) 1 end] - if {[string first "i7" $name] == 0} { - set name [string range $name 2 end] - set b "*" - } else { - set b "" - } +foreach event $events { + $event cleanstrings + + set name [$event get szevtname] altrow set rsvicon "" set alta "" - switch $r(ersvtype) { + switch [$event get ersvtype] { 1 { set rsvicon "175_1_00_Reservation_Watch.png" } 2 { set rsvicon "175_1_00_Reservation_Watch.png" } 3 { set rsvicon "175_1_11_Reservation_Record.png" } @@ -48,16 +35,16 @@ foreach r $res { 6 { set rsvicon "745_1_11_Video_1REC.png"; set alta "Sleep" } 7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" set alta "Auto Update" } - default { set alta "Unknown type $r(ersvtype)" } + default { set alta "Unknown type [$event get ersvtype]" } } if {$name == ""} { set name "-- $alta --" } set series 0 - if {$r(ucRecKind) == 4} { + if {[$event get ucRecKind] == 4} { set RKIcon "175_1_11_Series_Record.png" set series 1 } else { - switch $r(erepeat) { + switch [$event get erepeat] { 1 {set RKIcon "521_1_00_RP_Daily_C.png"} 2 {set RKIcon "521_1_00_RP_Weekly_C.png"} 3 {set RKIcon "521_1_00_RP_Weekdays_C.png"} @@ -67,38 +54,81 @@ foreach r $res { } if {$rsvicon ne ""} { - set rsvicon " + set rsvicon " } if {$RKIcon ne ""} { - set RKIcon " + set RKIcon " } -# puts "" - puts "" - puts "" - puts "" - puts "" - if { $r(nsttime) < [clock seconds] } { - puts " + + + " } else { - puts "" } - puts "[clock format $r(nsttime) -format {%c %Z}]" - puts "" - puts "" + + set s [$event get nsttime] + set d [$event get nduration] + set e $($s + $d) + set n [clock seconds] + + if { $n > $e } { + puts "" + + puts "" + + puts "" + puts "" + puts "" puts "" } puts "
SlotProgrammeDurationChannelDate/TimeModeEvent/Series ID
{$r(ulslot)}$b$name[clock format $r(nduration) -format %T]$r(usLcn)[string range $r(szSvcName) 1 end]" + if {[$event get usLcn] ne ""} { + puts " + [$event get usLcn] + + [$event get szSvcName]" + puts " 

$rsvicon $RKIcon" - set crid [join [lrange [split $r(szCRID) "/"] 1 end]] + + puts "$name" + } else { + puts "" + } + puts "[clock format $s -format {%c %Z}]" + + if {$d > 0 && $n > $s && $n < $e} { + puts "
" + set perc [expr [expr $n - $s] * 100 / $d] + puts "" + puts [progressbar $perc] + } + + puts "
[clock format [$event get nduration] -format %T]$rsvicon $RKIcon" + set crid [join [lrange [split [$event get szCRID] /] 1 end]] if {$crid != ""} { puts -nonewline " - $r(szCRID)" + [$event get szCRID]" + puts "" + } + puts "" + set flag 0 + foreach ev [split [$event get szEventToRecord] "|"] { + if {$ev eq ""} { continue } + set ev [string range $ev 1 end] + if {$flag} { puts "
" } + incr flag + set crid [join [lrange [split $ev /] 1 end]] + puts -nonewline " + + $ev" + puts "" } puts "
" puts "Click on the CRID to view episodes." -$db close diff --git a/var/mongoose/lib/rsv.class b/var/mongoose/lib/rsv.class new file mode 100755 index 00000000..f29e402c --- /dev/null +++ b/var/mongoose/lib/rsv.class @@ -0,0 +1,74 @@ +source /mod/var/mongoose/lib/setup + +if {![exists -proc class ]} { package require oo } +if {![exists -proc sqlite3.open ]} { package require sqlite3 } +if {![exists -proc settings ]} { require settings.class } + +set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db] +$rsvdb query {attach database '/var/lib/humaxtv/channel.db' as channel} + +class rsv { + ulslot 0 + ersvtype 0 + hsvc 0 + nsttime 0 + szsttime 0 + nduration 0 + erepeat 0 + usevtid 0 + szevtname {} + ulPreOffset 0 + ulPostOffset 0 + ulProgramId 0 + ulSeriesId 0 + ucVolume 0 + ucInputMode 0 + usChNum 0 + ucRecKind 0 + ucCRIDType 0 + szCRID {} + szFPBRecPath {} + szRecordedProgCrid {} + szEventToRecord {} + aulEventToRecordInfo {} + bRecomRsv 0 + usLastRecordedEvtId 0 + eReady 0 + szSvcName {} + usLcn 0 + sort 0 +} + +rsv method cleanstrings {} { + set szevtname [string range $szevtname 1 end] + if {[string first "i7" $szevtname] == 0} { + set szevtname [string range $szevtname 2 end] + } + set szSvcName [string range $szSvcName 1 end] +} + +proc {rsv list} {} { + catch { $::rsvdb query {.mode tcl} } + + set res [$::rsvdb query { + select tbl_reservation.*, + channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn, + case when ersvtype > 3 then 1 else 0 end as sort + from tbl_reservation + left join channel.TBL_SVC + on main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc + order by sort, nsttime + }] + + set records {} + foreach rec $res { + lappend records [rsv new $rec] + } + + return $records +} + +proc {rsv cleanup} {} { + catch {$::rsvdb close} +} +