2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2011-07-01 22:56:53 +00:00
|
|
|
source /mod/var/mongoose/lib/setup
|
|
|
|
require epg.class spinner.class altrow
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
puts "Content-Type: text/html"
|
|
|
|
puts ""
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
header
|
2011-06-07 13:26:45 +00:00
|
|
|
|
2011-09-14 22:38:22 +00:00
|
|
|
require totop
|
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
puts "<script type=text/javascript src=/js/jquery.highlight.js></script>"
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
cgi_input
|
|
|
|
#cgi_dump
|
2011-06-29 22:53:15 +00:00
|
|
|
|
2011-06-30 22:10:22 +00:00
|
|
|
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 {[dict exists $_cgi term]} {
|
|
|
|
set lterm [dict get $_cgi term]
|
|
|
|
|
|
|
|
if {[string match {CRID:*} $lterm]} {
|
|
|
|
set crid [string range $lterm 5 end]
|
|
|
|
} elseif {[string match {SCRID:*} $lterm]} {
|
|
|
|
set scrid [string range $lterm 6 end]
|
|
|
|
}
|
|
|
|
} elseif {$crid ne ""} {
|
|
|
|
set _cgi(term) "CRID:$crid"
|
|
|
|
} elseif {$scrid ne ""} {
|
|
|
|
set _cgi(term) "SCRID:$scrid"
|
|
|
|
}
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
require epg_search
|
2011-06-29 22:53:15 +00:00
|
|
|
|
|
|
|
[spinner new {
|
|
|
|
text "Searching EPG..."
|
|
|
|
size "1.2em"
|
|
|
|
style "margin: 1em;"
|
|
|
|
}] start
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
require epg_popup
|
2011-06-29 22:53:15 +00:00
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
#set _cgi [dict create term "doctor who"]
|
|
|
|
#set env(REQUEST_URI) "test"
|
|
|
|
|
|
|
|
set cmd "search"
|
2011-06-29 22:53:15 +00:00
|
|
|
if {$searchfull} { set cmd "searchall" }
|
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
if {$ct > 0 } {
|
|
|
|
set records [epg fetch dump -type $ct]
|
2011-06-08 23:33:35 +00:00
|
|
|
} elseif {$crid ne ""} {
|
|
|
|
set records [epg fetch dump -crid $crid]
|
|
|
|
} elseif {$scrid ne ""} {
|
|
|
|
set records [epg fetch dump -scrid $scrid]
|
2011-06-29 22:53:15 +00:00
|
|
|
} elseif {$searchterm ne ""} {
|
|
|
|
set records [epg fetch $cmd -extra $searchterm]
|
|
|
|
} else {
|
|
|
|
set records {}
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
set favlist [epg favlist]
|
|
|
|
|
2011-06-29 22:53:15 +00:00
|
|
|
if {[llength $records] > 0} {
|
|
|
|
puts {
|
2011-06-07 13:26:45 +00:00
|
|
|
<table class=borders id=results style="clear: both;margin: 0.5em 0 0 0">
|
|
|
|
<tr>
|
|
|
|
<th>Date</th>
|
2011-06-09 21:16:30 +00:00
|
|
|
<th colspan=3>Channel</th>
|
2011-06-07 13:26:45 +00:00
|
|
|
<th>Programme</th>
|
|
|
|
<th>Synopsis</th>
|
|
|
|
</tr>
|
2011-06-29 22:53:15 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
puts "No results found."
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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] {
|
2011-06-14 11:48:55 +00:00
|
|
|
if {$favlist != "" && [$record get service_id] ni $favlist} {
|
|
|
|
continue
|
|
|
|
}
|
2011-06-07 13:26:45 +00:00
|
|
|
altrow
|
2011-06-14 11:48:55 +00:00
|
|
|
$record get_channel_info
|
2011-07-18 19:26:58 +00:00
|
|
|
|
|
|
|
set ended [$record ended]
|
|
|
|
|
|
|
|
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>"}
|
|
|
|
puts "
|
2011-06-07 13:26:45 +00:00
|
|
|
[clock format [$record get start] -format "%a %d %b %Y"]<br>
|
2011-07-18 19:26:58 +00:00
|
|
|
[clock format [$record get start] -format "%H:%M %Z"]"
|
|
|
|
puts "</td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
puts "<td>[$record get channel_num]</td>"
|
2011-06-09 21:16:30 +00:00
|
|
|
puts "<td>[$record channel_icon 50]</td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
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>"
|
|
|
|
}
|
|
|
|
puts "</table>"
|
|
|
|
|
2011-06-29 22:53:15 +00:00
|
|
|
if {$searchterm != ""} {
|
2011-06-07 13:26:45 +00:00
|
|
|
puts "
|
|
|
|
<script type=text/javascript>
|
2011-07-07 22:33:19 +00:00
|
|
|
\$('#results').highlight('$searchterm');
|
2011-06-07 13:26:45 +00:00
|
|
|
</script>
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
|
|
|
epg cleanup
|
2011-07-01 22:56:53 +00:00
|
|
|
footer
|
2011-06-07 13:26:45 +00:00
|
|
|
|