#!/mod/bin/jimsh package require cgi source /mod/webif/lib/setup puts "Content-Type: text/html" puts "" header require epg.class spinner.class altrow epg_search totop cgi_input puts {} [spinner new { text "Loading Now/Next Information..." size "1.2em" style "margin: 1em;" }] start require epg_popup set stt [cgi_get stt [clock seconds]] if {$stt <= [clock seconds]} { set stt [clock seconds] set current 1 } else { set current 0 } set favgroup [[settings] channel_group] set hours 4.0 set seconds $($hours * 3600) set ostt $stt set stt [expr int($stt / 1800.0) * 1800] set ett $(int($stt + $seconds)) set offset $(($ostt - $stt) / 1800.0) set chanpx 120 set eventpx 1000 set totalpx $($chanpx + $eventpx) set contwidth $($totalpx + 50) set hourpx $($eventpx / $hours) set minpx $($hourpx / 60.0) set secpx $($minpx / 60.0) set start [clock milliseconds] if {$::qepg} { if {$favgroup} { set records [epg dbfetch dump \ -trange "$stt:$ett" -fav $favgroup] } else { set records [epg dbfetch dump -trange "$stt:$ett"] } } else { require channelsort set records [channelsort [epg fetch dump -trange "$stt:$ett"]] } set got [clock milliseconds] puts "
" if {$stt > [clock seconds]} { puts "" } puts "" puts "
" puts "
" puts "
" puts [clock format $stt -format {%a %D}] puts "
" puts "
 
" for {set i 0} {$i < $hours * 2} {incr i} { puts "
" puts "[clock format $($stt + 1800 * $i) -format "%H:%M"]
" } set lim 0 set lcn 0 set bg "odd" foreach e $records { set chnum [$e get channel_num] if {$chnum == 0} { continue } if {$chnum != $lcn} { puts "
" puts "[$e channel_icon 30] " puts "$chnum [$e get channel_name]
" set lcn $chnum set le 0 set pos 0 if {$bg eq "odd"} { set bg "even" } else { set bg "odd" } } set es [$e get start] set ee [expr $es + [$e get duration]] if {$es < $le} continue if {$es < $stt} { set es $stt } if {$ee > $ett} { set ee $ett } set le $ee set left [expr int(($es - $stt) * $secpx)] set right [expr int(($ee - $stt - 1) * $secpx)] set px $($right - $left) if {$pos < $left} { set px $($px + $left - $pos - 1) } elseif {$pos > $left} { set px $($px - ($pos - $left - 1)) } incr pos $px $e process_sched set recopts 1 if {[$e get series_crid] ne ""} { set recopts 2 } set perc [$e percent] set showing 0 if {$perc > 0 && $perc < 100} { set showing 1 } set txt "[cgi_quote_html [$e get name]] ([\ clock format $es -format "%H:%M"] - [\ clock format $ee -format "%H:%M"])" if {$showing} { append txt " ($perc%)" } append txt "" set htxt "[cgi_quote_html [$e get name]] ([\ clock format $es -format "%H:%M"] - [\ clock format $ee -format "%H:%M"])" if {$showing} { append hxt " ($perc%)" } puts "" } puts "
" puts "
" puts "
" set earlier $($stt - 3600 * 4) puts "
" puts " Visit settings to change EPG options.
" epg cleanup set end [clock milliseconds] puts " Retrieved in: [expr [expr $got - $start] / 1000.0] seconds. " footer