webif/var/mongoose/include/sched.jim

105 lines
2.7 KiB
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow
set db [sqlite3.open /var/lib/humaxtv/rsv.db]
$db query {attach database '/var/lib/humaxtv/channel.db' as channel}
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 "<table class=borders>"
puts "<tr>"
#puts "<th>Slot</th>"
puts "<th colspan=2>Programme</th>"
puts "<th>Duration</th>"
puts "<th colspan=2>Channel</th>"
puts "<th>Date/Time</th>"
puts "<th>Mode</th>"
puts "<th>Event/Series ID</th>"
puts "</tr>"
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 ""
}
altrow
set rsvicon ""
set alta ""
switch $r(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"; set alta "Wake-up" }
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)" }
}
if {$name == ""} { set name "-- $alta --" }
set series 0
if {$r(ucRecKind) == 4} {
set RKIcon "175_1_11_Series_Record.png"
set series 1
} else {
switch $r(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 ""}
}
}
if {$rsvicon ne ""} {
set rsvicon "<img src='images/$rsvicon' height=15>
}
if {$RKIcon ne ""} {
set RKIcon "<img src='images/$RKIcon' height=15>
}
# puts "<td>{$r(ulslot)}</td>"
puts "<td>$b</td><td>$name</td>"
puts "<td>[clock format $r(nduration) -format %T]</td>"
puts "<td>$r(usLcn)</td>"
puts "<td>[string range $r(szSvcName) 1 end]</td>"
if { $r(nsttime) < [clock seconds] } {
puts "<td class=blood>"
} else {
puts "<td>"
}
puts "[clock format $r(nsttime) -format {%c %Z}]</td>"
puts "<td>$rsvicon $RKIcon</td>"
puts "<td>"
set crid [join [lrange [split $r(szCRID) "/"] 1 end]]
if {$crid != ""} {
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
if $series { puts -nonewline "s" }
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
$r(szCRID)"
}
puts "</td>"
puts "</tr>"
}
puts "</table>"
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
$db close