2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2012-05-21 20:23:41 +00:00
|
|
|
source /mod/webif/lib/setup
|
2013-02-17 22:58:37 +00:00
|
|
|
require epg.class spinner.class altrow settings.class
|
2011-06-07 13:26:45 +00:00
|
|
|
|
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
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
set ct [cgi_get ct 0]
|
|
|
|
set crid [cgi_get crid ""]
|
|
|
|
set scrid [cgi_get scrid ""]
|
2011-06-30 22:10:22 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
if {[cgi_exists term]} {
|
|
|
|
set lterm [cgi_get term]
|
2011-06-30 22:10:22 +00:00
|
|
|
|
|
|
|
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 cmd "search"
|
2011-06-29 22:53:15 +00:00
|
|
|
if {$searchfull} { set cmd "searchall" }
|
|
|
|
|
2013-02-17 22:58:37 +00:00
|
|
|
set dedup 0
|
2011-06-07 13:26:45 +00:00
|
|
|
if {$ct > 0 } {
|
|
|
|
set records [epg fetch dump -type $ct]
|
2013-02-17 22:58:37 +00:00
|
|
|
if {[[settings] genrededup]} { set dedup 1 }
|
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 ""} {
|
2012-10-30 18:58:54 +00:00
|
|
|
set records [epg dbfetch $cmd -term $searchterm]
|
2011-06-29 22:53:15 +00:00
|
|
|
} 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
|
|
|
|
}
|
|
|
|
|
2013-02-17 22:58:37 +00:00
|
|
|
set seen {}
|
2011-06-07 13:26:45 +00:00
|
|
|
set i 0
|
|
|
|
foreach record [lsort -command rsort $records] {
|
2013-02-17 22:58:37 +00:00
|
|
|
if {$dedup} {
|
|
|
|
set ename [$record get name]
|
|
|
|
if {$ename in $seen} continue
|
|
|
|
lappend seen $ename
|
|
|
|
}
|
|
|
|
|
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>
|
2012-02-07 22:48:54 +00:00
|
|
|
<a href=/cgi-bin/epg/service.jim?service=[$record get service_id]>
|
2011-06-07 13:26:45 +00:00
|
|
|
[$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
|
|
|
|