forked from hummypkg/webif
2fb26975e2
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@433 2a923420-c742-0410-a762-8d5b09965624
160 lines
3.5 KiB
Plaintext
Executable File
160 lines
3.5 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
package require cgi
|
|
source /mod/var/mongoose/lib/setup
|
|
require epg.class spinner.class altrow epg_search totop
|
|
|
|
puts {<link type="text/css" href="/css/epg.css" rel="Stylesheet" />}
|
|
|
|
[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 {
|
|
<table class=epggrid style="float: left; clear: both">
|
|
<tr>
|
|
<td></td>
|
|
<td class=epgdate colspan=48>
|
|
}
|
|
puts [clock format $stt -format {%a %D}]
|
|
puts { </td></tr><tr><td></td> }
|
|
|
|
for {set i 0} {$i < 48} {incr i} {
|
|
puts "<td class=epgdummy></td>"
|
|
}
|
|
puts "</tr><tr><td></td>"
|
|
|
|
for {set i 0} {$i < 8} {incr i} {
|
|
puts "<td class=epgtime colspan=6>
|
|
[clock format $($stt + 1800 * $i) -format "%H:%M"]</td>"
|
|
}
|
|
|
|
puts "</tr>"
|
|
|
|
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 "</tr>" }
|
|
|
|
puts "<tr>";
|
|
puts "<td class=epgchan>[$record channel_icon 30] "
|
|
puts "$chnum
|
|
<a href=/cgi-bin/epg_service.jim?service=[$record get service_id]>
|
|
[$record get channel_name]
|
|
</a></td>"
|
|
|
|
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 "<td class=\"epgprog $bg\" colspan=$columns>\n"
|
|
|
|
if {$showing} {
|
|
puts "
|
|
<div class=\"meter-wrap\" style=\"width: ${pxwidth}px\">
|
|
<div class=\"meter-value\" style=\"width: ${perc}%\">
|
|
<div class=\"meter-text\""
|
|
} else {
|
|
puts "<div style=\"width: ${pxwidth}px\""
|
|
}
|
|
puts " title=\"${txt}\" alt=\"${txt}\">\n"
|
|
|
|
puts "<a class=event href=# xs=[$record get service_id]
|
|
xe=[$record get event_id] sch=2 rec=1>"
|
|
puts $txt
|
|
puts "</a>\n"
|
|
puts "</div>"
|
|
if {$showing} { puts "</div></div>" }
|
|
puts "</td>\n"
|
|
}
|
|
if {$lcn > 0} { puts "</tr>" }
|
|
puts "</table><br><br>"
|
|
|
|
puts {
|
|
<small><button id=epgswitch>
|
|
Switch to standard now/next display.
|
|
</button></small>
|
|
|
|
<script type=text/javascript>
|
|
$(document).ready(function() {
|
|
|
|
$('#epgswitch').button().click(function() {
|
|
window.location = '/epg.shtml';
|
|
});
|
|
$('#earlier').button().click(function() {
|
|
window.location = '/xepg.shtml?stt=<?php echo $stt - 3600*4; ?>';
|
|
});
|
|
$('#later').button().click(function() {
|
|
window.location = '/xepg.shtml?stt=<?php echo $ett; ?>';
|
|
});
|
|
|
|
});
|
|
</script>
|
|
}
|
|
|
|
puts "
|
|
<a href=/cgi-bin/settings.jim>
|
|
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
|
Visit settings to change EPG options.
|
|
</a><br>
|
|
"
|
|
|
|
set end [clock milliseconds]
|
|
puts "<font class=footnote>
|
|
Retrieved in: [expr [expr $got - $start] / 1000.0] seconds.
|
|
Rendered in: [expr [expr $end - $start] / 1000.0] seconds.
|
|
</font>"
|
|
|
|
epg cleanup
|
|
|