43db44d742
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@210 2a923420-c742-0410-a762-8d5b09965624
113 lines
2.4 KiB
Plaintext
Executable File
113 lines
2.4 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
package require cgi
|
|
source /mod/var/mongoose/lib/epg.class
|
|
source /mod/var/mongoose/lib/spinner.class
|
|
source /mod/var/mongoose/lib/altrow
|
|
|
|
puts "Content-Type: text/html"
|
|
puts ""
|
|
|
|
source /mod/var/mongoose/html/lib/header.jim
|
|
|
|
puts "<script type=text/javascript src=/js/highlight.js></script>"
|
|
|
|
cgi_input
|
|
#cgi_dump
|
|
|
|
source /mod/var/mongoose/lib/epg_search
|
|
|
|
[spinner new {
|
|
text "Searching EPG..."
|
|
size "1.2em"
|
|
style "margin: 1em;"
|
|
}] start
|
|
|
|
source /mod/var/mongoose/lib/epg_popup
|
|
|
|
#set _cgi [dict create term "doctor who"]
|
|
#set env(REQUEST_URI) "test"
|
|
|
|
set cmd "search"
|
|
if {$searchfull} { set cmd "searchall" }
|
|
|
|
set ct 0
|
|
catch { set ct [dict get $_cgi ct] }
|
|
set crid ""
|
|
catch { set crid [dict get $_cgi crid] }
|
|
set scrid ""
|
|
catch { set scrid [dict get $_cgi scrid] }
|
|
|
|
if {$ct > 0 } {
|
|
set records [epg fetch dump -type $ct]
|
|
} elseif {$crid ne ""} {
|
|
set records [epg fetch dump -crid $crid]
|
|
} elseif {$scrid ne ""} {
|
|
set records [epg fetch dump -scrid $scrid]
|
|
} elseif {$searchterm ne ""} {
|
|
set records [epg fetch $cmd -extra $searchterm]
|
|
} else {
|
|
set records {}
|
|
}
|
|
|
|
set favlist [epg favlist]
|
|
|
|
if {[llength $records] > 0} {
|
|
puts {
|
|
<table class=borders id=results style="clear: both;margin: 0.5em 0 0 0">
|
|
<tr>
|
|
<th>Date</th>
|
|
<th colspan=3>Channel</th>
|
|
<th>Programme</th>
|
|
<th>Synopsis</th>
|
|
</tr>
|
|
}
|
|
} else {
|
|
puts "No results found."
|
|
}
|
|
|
|
proc rsort {v1 v2} {
|
|
set v1s [$v1 get start]
|
|
set v2s [$v2 get start]
|
|
|
|
if {$v1s == $v2s} { return 0 }
|
|
if {$v1s > $v2s } { return 1 }
|
|
return -1
|
|
}
|
|
|
|
set i 0
|
|
foreach record [lsort -command rsort $records] {
|
|
if {$favlist != "" && [$record get service_id] ni $favlist} {
|
|
continue
|
|
}
|
|
altrow
|
|
$record get_channel_info
|
|
puts "<td nowrap>
|
|
[clock format [$record get start] -format "%a %d %b %Y"]<br>
|
|
[clock format [$record get start] -format "%H:%M %Z"]</td>"
|
|
puts "<td>[$record get channel_num]</td>"
|
|
puts "<td>[$record channel_icon 50]</td>"
|
|
puts "<td nowrap>
|
|
<a href=/cgi-bin/epg_service.jim?service=[$record get service_id]>
|
|
[$record get channel_name]
|
|
</a></td>"
|
|
puts [$record cell]
|
|
puts "<td>[$record get text]</td><td>[$record get warning]</td>"
|
|
puts "</tr>"
|
|
flush stdout
|
|
}
|
|
puts "</table>"
|
|
|
|
if {$searchterm != ""} {
|
|
puts "
|
|
<script type=text/javascript>
|
|
highlight(document.getElementById(\"results\"),
|
|
\"$searchterm\");
|
|
</script>
|
|
"
|
|
}
|
|
|
|
epg cleanup
|
|
source /mod/var/mongoose/html/lib/footer.jim
|
|
|