diff --git a/var/mongoose/cgi-bin/epg_info.jim b/var/mongoose/cgi-bin/epg_info.jim index 0b8dfebb..ff13d0af 100755 --- a/var/mongoose/cgi-bin/epg_info.jim +++ b/var/mongoose/cgi-bin/epg_info.jim @@ -10,15 +10,10 @@ puts "" cgi_input #cgi_dump -set service 0 -catch { set service [dict get $_cgi service] } -set event 0 -catch { set event [dict get $_cgi event] } +set service [cgi_get service 0] +set event [cgi_get event 0] if {! [dict exists $_cgi bare]} { header } -#set service 8448 -#set event 30843 - set record [lindex [epg fetch dump -service $service -event $event] 0] $record get_channel_info set others [$record othertimes] diff --git a/var/mongoose/cgi-bin/sched_cancel.jim b/var/mongoose/cgi-bin/sched_cancel.jim new file mode 100755 index 00000000..a63cfe11 --- /dev/null +++ b/var/mongoose/cgi-bin/sched_cancel.jim @@ -0,0 +1,26 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/var/mongoose/lib/setup +require rsv.class + +puts "Content-Type: text/html" +puts "" + +cgi_input +#cgi_dump + +set slot [cgi_get slot 0] +set table [cgi_get table TBL_RESERVATION] + +set event [rsv slot $table $slot] + +if {$table eq "pending"} { + $event remove_pending + exit +} + +$event clear_ulslot +$event set_delete +$event insert + diff --git a/var/mongoose/cgi-bin/sched_info.jim b/var/mongoose/cgi-bin/sched_info.jim new file mode 100755 index 00000000..2b838e2c --- /dev/null +++ b/var/mongoose/cgi-bin/sched_info.jim @@ -0,0 +1,123 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/var/mongoose/lib/setup +require rsv.class + +puts "Content-Type: text/html" +puts "" + +cgi_input +#cgi_dump + +set table [cgi_get table TBL_RESERVATION] +set slot [cgi_get slot 0] + +set event [rsv slot $table $slot] + +set rsvicon [$event icon] +if {$rsvicon ne ""} { + set rsvicon " +} + +set RKIcon [$event RKIcon] +if {$RKIcon ne ""} { + set RKIcon " +} + +if {[$event get ucRecKind] == 4} { + set series 1 +} else { + set series 0 +} + +puts " + + + + + + + + + + + + +" + +set s [$event get nsttime] +set d [$event get nduration] +set e $($s + $d) +set n [clock seconds] + +if { $n > $e } { + puts " + + + + +" + +set crid [join [lrange [split [$event get szCRID] /] 1 end]] +if {$crid != ""} { + puts "" +} +puts "" +puts "" +puts "
Event [$event get ulslot]$rsvicon $RKIcon
Channel +" +if {[$event get usLcn] ne ""} { + puts " + + - [$event get usLcn] - [$event channel_name] + " +} + +puts " +
Event Name[$event name]
Start" +} else { + puts "" +} +puts "[clock format $s -format "%a %d %b %Y"] + [clock format $s -format "%H:%M %Z"]" + +if {$d > 0 && $n > $s && $n < $e} { + puts "
" + set perc [expr [expr $n - $s] * 100 / $d] + puts "" + puts [progressbar $perc] +} + +puts " +
Duration[clock format [$event get nduration] -format %T]
" + if $series { puts "Series" } else { puts "Event" } + puts " CRID" + puts -nonewline " + + [$event get szCRID]" + puts "
Events" +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 "
Accepted" +if {[$event get aulEventToRecordInfo] != ""} { + puts "Yes" +} +puts "
" + diff --git a/var/mongoose/html/img/add.png b/var/mongoose/html/img/add.png new file mode 100644 index 00000000..f91195e2 Binary files /dev/null and b/var/mongoose/html/img/add.png differ diff --git a/var/mongoose/html/img/close.png b/var/mongoose/html/img/close.png new file mode 100644 index 00000000..12beb922 Binary files /dev/null and b/var/mongoose/html/img/close.png differ diff --git a/var/mongoose/include/sched.jim b/var/mongoose/include/sched.jim index 595898d5..e5086133 100755 --- a/var/mongoose/include/sched.jim +++ b/var/mongoose/include/sched.jim @@ -4,6 +4,7 @@ source /mod/var/mongoose/lib/setup require altrow rsv.class progressbar puts { +
} -proc eventheader {} { +proc eventheader {{table TBL_RESERVATION}} { puts { + } + + if {$table eq "pending" } { puts "" } + + puts { - - } } -proc eventrow {event} { +proc eventrow {event {table TBL_RESERVATION}} { set name [$event name] altrow - set rsvicon "" - 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" } - 5 { set rsvicon "745_1_10_Video_2Live.png" } - 6 { set rsvicon "745_1_11_Video_1REC.png" } - 7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" } - } - - set series 0 + set rsvicon [$event icon] + set RKIcon [$event RKIcon] if {[$event get ucRecKind] == 4} { - set RKIcon "175_1_11_Series_Record.png" set series 1 } else { - 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"} - 4 {set RKIcon "521_1_00_RP_Weekend_C.png"} - default {set RKIcon ""} - } + set series 0 } if {$rsvicon ne ""} { @@ -96,6 +133,16 @@ proc eventrow {event} { set RKIcon " } + if {$table eq "pending"} { + if {[$event get action] == 0} { + set icon "add" + } else { + set icon "close" + } + puts "" + } + puts "" if {[$event get usLcn] ne ""} { @@ -111,7 +158,10 @@ proc eventrow {event} { puts "" } - puts "" + puts "" set s [$event get nsttime] set d [$event get nduration] @@ -138,36 +188,12 @@ proc eventrow {event} { puts "" puts "" - puts "" - puts "" if {[$event get aulEventToRecordInfo] != ""} { - puts "" + puts "" + } else { + puts "" } puts "" } @@ -178,9 +204,9 @@ proc eventfooter {} { set events [rsv list pending] if {[llength $events] > 0} { - puts "

Pending Scheduled Events

" - eventheader - foreach event $events {eventrow $event} + puts "

Pending Schedule Events

" + eventheader pending + foreach event $events {eventrow $event pending} eventfooter puts { diff --git a/var/mongoose/lib/rsv.class b/var/mongoose/lib/rsv.class index da5f0ef2..8eb64fb1 100755 --- a/var/mongoose/lib/rsv.class +++ b/var/mongoose/lib/rsv.class @@ -12,6 +12,7 @@ if {![file exists /var/lib/humaxtv/rsvp.db]} { set tdb [sqlite3.open /var/lib/humaxtv/rsvp.db] $tdb query {drop table TBL_VERSION} $tdb query {alter table TBL_RESERVATION rename to pending} + $tdb query {alter table pending add column action int} $tdb query {delete from pending} $tdb close } @@ -47,6 +48,7 @@ class rsv { szSvcName {} usLcn 0 sort 0 + action 0 } rsv method clear_ulslot {} { @@ -75,6 +77,42 @@ rsv method channel_name {} { return [string range $szSvcName 1 end] } +rsv method icon {} { + set rsvicon "" + switch [$self 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" } + 5 { set rsvicon "745_1_10_Video_2Live.png" } + 6 { set rsvicon "745_1_11_Video_1REC.png" } + 7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" } + } + return $rsvicon +} + +rsv method RKIcon {} { + if {[$self get ucRecKind] == 4} { + set RKIcon "175_1_11_Series_Record.png" + } else { + switch [$self 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"} + 4 {set RKIcon "521_1_00_RP_Weekend_C.png"} + default {set RKIcon ""} + } + } + return $RKIcon +} + +rsv method set_delete {} { + set action 1 +} + +rsv method remove_pending {} { + $::rsvdb query "delete from pending where ulslot = [$self get ulslot]" +} + rsv method fix_hsvc {} { global rsvdb @@ -124,6 +162,11 @@ rsv method insert {{table pending}} { set fields [lreplace $fields $df $df] } + if {$table ne "pending"} { + set df [lsearch $fields "action"] + set fields [lreplace $fields $df $df] + } + set vals {} foreach field $fields { # Escape any quotes embedded in the data. @@ -194,6 +237,21 @@ proc {rsv entry} {{table TBL_RESERVATION} crid svc} { return 0 } +proc {rsv slot} {{table TBL_RESERVATION} slot} { + set res [$::rsvdb query " + select $table.*, + channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn + from $table + left join channel.TBL_SVC + on $table.hSvc = channel.TBL_SVC.hSvc + where ulslot = %s" $slot] + + if {[llength $res] > 0} { + return [rsv new [lindex $res 0]] + } + return 0 +} + proc {rsv cleanup} {} { catch {$::rsvdb close} } @@ -201,8 +259,10 @@ proc {rsv cleanup} {} { proc {rsv commit} {} { $::rsvdb query {begin transaction} foreach rec [rsv list pending] { - $rec clear_ulslot - $rec insert TBL_RESERVATION + if {[$rec get action] == 0} { + $rec clear_ulslot + $rec insert TBL_RESERVATION + } } $::rsvdb query {delete from pending} $::rsvdb query {commit transaction}
Action  Channel Programme Start Time Duration ModeEvent/Series IDEvents
+ [$event get ulslot] 

 $name + $name + [clock format [$event get nduration] -format %T]$rsvicon $RKIcon" - set crid [join [lrange [split [$event get szCRID] /] 1 end]] - if {$crid != ""} { - puts -nonewline " - - [$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 "
*\"Accepted