#!/mod/bin/jimsh
package require sqlite3
source /mod/var/mongoose/lib/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 "
"
puts ""
#puts "Slot | "
puts "Programme | "
puts "Duration | "
puts "Channel | "
puts "Date/Time | "
puts "Mode | "
puts "Series ID | "
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 ""
}
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 "Software Update" }
default { set alta "Unknown type $r(ersvtype)" }
}
if {$name == ""} { set name "-- $alta --" }
if {$r(ucRecKind) == 4} {
set RKIcon "175_1_11_Series_Record.png"
} 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 "
}
if {$RKIcon ne ""} {
set RKIcon "
}
# puts "{$r(ulslot)} | "
puts "$b | $name | "
puts "[clock format $r(nduration) -format %T] | "
puts "$r(usLcn) | "
puts "[string range $r(szSvcName) 1 end] | "
puts "[clock format $r(nsttime) -format {%c %Z}] | "
puts "$rsvicon $RKIcon | "
puts "$r(szCRID) | "
puts ""
}
puts "
"
$db close