#!/mod/bin/jimsh package require cgi source /mod/var/mongoose/lib/setup require epg.class spinner.class altrow epg_search totop puts {} [spinner new { text "Loading Now/Next Information..." size "1.2em" style "margin: 1em;" }] start require epg_popup set start [clock milliseconds] set stt [clock seconds] set stt [expr int($stt / 1800) * 1800] set ett $($stt + 14400) if {$::qepg} { set records [epg dbfetch dump -trange "$stt:$ett"] } else { require channelsort set records [channelsort [epg fetch dump -trange "$stt:$ett"]] } set got [clock milliseconds] set favlist [epg favlist] puts { } for {set i 0} {$i < 48} {incr i} { puts "" } puts "" for {set i 0} {$i < 8} {incr i} { puts "" } puts "" set lcn 0 set bg "odd" foreach record $records { if {$favlist != "" && [$record get service_id] ni $favlist} { continue } set chnum [$record get channel_num] if {$chnum == 0} { continue } if {$chnum != $lcn} { if {$lcn > 0} { puts "" } puts ""; puts "" set lcn $chnum set le 0 if {$bg eq "odd"} { set bg "even" } else { set bg "odd" } } set es [$record get start] set ee [expr $es + [$record get duration]] set txt "[cgi_quote_html [$record get name]] ([\ clock format $es -format "%H:%M"] - [\ clock format $ee -format "%H:%M"])" if {$es < $le} { continue } if {$es < $stt} { set es $stt } if {$ee > $ett} { set ee $ett } set le $ee set columns [expr int(($ee - $es) / 300)] if {$columns < 1} { set columns 1 } set pxwidth $($columns * 13) set perc [$record percent] set showing [$record showing] if {$showing} { append txt " ($perc%)" } puts "\n" } if {$lcn > 0} { puts "" } puts "
} puts [clock format $stt -format {%a %D}] puts {
[clock format $($stt + 1800 * $i) -format "%H:%M"]
[$record channel_icon 30] " puts "$chnum [$record get channel_name] \n" if {$showing} { puts "
\n" puts "" puts $txt puts "\n" puts "
" if {$showing} { puts "
" } puts "


" puts { } puts " Visit settings to change EPG options.
" set end [clock milliseconds] puts " Retrieved in: [expr [expr $got - $start] / 1000.0] seconds. Rendered in: [expr [expr $end - $start] / 1000.0] seconds. " epg cleanup