2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
|
|
|
source /mod/var/mongoose/lib/epg.class
|
|
|
|
source /mod/var/mongoose/lib/altrow
|
2011-06-09 00:42:26 +00:00
|
|
|
source /mod/var/mongoose/lib/cat
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
puts "Content-Type: text/html"
|
|
|
|
puts ""
|
|
|
|
|
|
|
|
source /mod/var/mongoose/html/lib/header.jim
|
|
|
|
|
|
|
|
puts "<script type=text/javascript src=/js/highlight.js></script>"
|
|
|
|
|
2011-06-09 00:42:26 +00:00
|
|
|
source /mod/var/mongoose/lib/epg_popup
|
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
cgi_input
|
|
|
|
#cgi_dump
|
|
|
|
#set _cgi [dict create term "doctor who"]
|
|
|
|
#set env(REQUEST_URI) "test"
|
|
|
|
|
|
|
|
set term ""
|
|
|
|
catch { set term [dict get $_cgi term] }
|
|
|
|
set cmd "search"
|
|
|
|
if {[dict exists $_cgi full]} { set cmd "searchall" }
|
|
|
|
set ct 0
|
|
|
|
catch { set ct [dict get $_cgi ct] }
|
2011-06-08 23:33:35 +00:00
|
|
|
set crid ""
|
|
|
|
catch { set crid [dict get $_cgi crid] }
|
|
|
|
set scrid ""
|
|
|
|
catch { set scrid [dict get $_cgi scrid] }
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
puts "
|
|
|
|
<form method=get action=/cgi-bin/epg_search.jim>
|
|
|
|
Search EPG: <input name=term size=20 maxlength=255 value=\"$term\">
|
|
|
|
<input type=checkbox name=full"
|
|
|
|
if {[dict exists $_cgi full]} { puts " checked" }
|
|
|
|
puts ">Search descriptions as well as titles.
|
|
|
|
<input type=submit value=Search>
|
|
|
|
"
|
|
|
|
|
|
|
|
set db [sqlite3.open /var/lib/humaxtv/setup.db]
|
|
|
|
set res [$db query {
|
|
|
|
select itemBlob from TBL_USERCONFIG
|
|
|
|
where itemName like 'EPG\_KEYWORD\_%%' ESCAPE '\'
|
|
|
|
}]
|
|
|
|
|
|
|
|
proc cts {type img text} {
|
|
|
|
puts "<a href=$::env(REQUEST_URI)?ct=$type>
|
|
|
|
<img height=18 border=0 src=/images/173_3_00_G3_$img.png> $text</a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
puts {
|
|
|
|
<br>
|
2011-06-09 00:42:26 +00:00
|
|
|
<table>
|
|
|
|
<tr><td rowspan=2>Content Type Searches</td>
|
|
|
|
<td>
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
2011-06-09 00:42:26 +00:00
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 1 "Movie" "Film/Drama"
|
2011-06-09 00:42:26 +00:00
|
|
|
puts "</td><td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 2 "News" "News/Current affairs"
|
2011-06-09 00:42:26 +00:00
|
|
|
puts "</td><td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 4 "Sports" "Sport"
|
2011-06-09 00:42:26 +00:00
|
|
|
puts "</td><td>"
|
|
|
|
cts 9 "Education" "Education/Science/Factual"
|
|
|
|
puts "</td><td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 10 "Leisure" "Leisure"
|
2011-06-09 00:42:26 +00:00
|
|
|
|
|
|
|
puts "</td></tr><tr><td>"
|
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 7 "Art" "Arts/Culture"
|
2011-06-09 00:42:26 +00:00
|
|
|
puts "</td><td>"
|
|
|
|
cts 3 "Show" "Show/Game show"
|
|
|
|
puts "</td><td>"
|
|
|
|
cts 5 "Children" "Children"
|
|
|
|
puts "</td><td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
cts 8 "Society" "Social/Political/Economic"
|
2011-06-09 00:42:26 +00:00
|
|
|
puts "</td><td>"
|
|
|
|
cts 6 "Music" "Music/Ballet/Dance"
|
|
|
|
|
|
|
|
puts "</tr></table>"
|
2011-06-07 13:26:45 +00:00
|
|
|
|
2011-06-09 00:47:52 +00:00
|
|
|
puts "<table cellpadding=5>"
|
2011-06-07 13:26:45 +00:00
|
|
|
if {[llength $res] > 0} {
|
2011-06-09 00:47:52 +00:00
|
|
|
puts "<tr><td>Keyword Searches</td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
foreach keyword $res {
|
|
|
|
set kw [string range [lindex $keyword 1] 1 end]
|
2011-06-09 00:47:52 +00:00
|
|
|
puts "<td><a href=$env(REQUEST_URI)?term=[cgi_quote_url $kw]>$kw
|
|
|
|
</a></td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
2011-06-09 00:47:52 +00:00
|
|
|
puts "</tr>"
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
2011-06-09 00:47:52 +00:00
|
|
|
puts "</table>"
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
$db close
|
|
|
|
|
|
|
|
puts "</form>"
|
|
|
|
|
|
|
|
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-07 13:26:45 +00:00
|
|
|
} elseif {$term ne ""} {
|
|
|
|
set records [epg fetch $cmd -extra $term]
|
|
|
|
}
|
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
set favlist [epg favlist]
|
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
puts {
|
|
|
|
<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>
|
|
|
|
}
|
|
|
|
|
|
|
|
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-06-07 13:26:45 +00:00
|
|
|
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>"
|
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>"
|
|
|
|
flush stdout
|
|
|
|
}
|
|
|
|
puts "</table>"
|
|
|
|
|
|
|
|
if {$term != ""} {
|
|
|
|
puts "
|
|
|
|
<script type=text/javascript>
|
|
|
|
highlight(document.getElementById(\"results\"), \"$term\");
|
|
|
|
</script>
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
|
|
|
epg cleanup
|
|
|
|
source /mod/var/mongoose/html/lib/footer.jim
|
|
|
|
|