#!/mod/bin/jimsh package require cgi source /mod/var/mongoose/lib/epg.class source /mod/var/mongoose/lib/altrow source /mod/var/mongoose/lib/cat puts "Content-Type: text/html" puts "" source /mod/var/mongoose/html/lib/header.jim puts "" source /mod/var/mongoose/lib/epg_popup 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] } set crid "" catch { set crid [dict get $_cgi crid] } set scrid "" catch { set scrid [dict get $_cgi scrid] } puts "
Search EPG: Search descriptions as well as titles. " 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 "  $text"; } puts {
Content Type Searches } cts 1 "Movie" "Film/Drama" puts "" cts 2 "News" "News/Current affairs" puts "" cts 4 "Sports" "Sport" puts "" cts 9 "Education" "Education/Science/Factual" puts "" cts 10 "Leisure" "Leisure" puts "
" cts 7 "Art" "Arts/Culture" puts "" cts 3 "Show" "Show/Game show" puts "" cts 5 "Children" "Children" puts "" cts 8 "Society" "Social/Political/Economic" puts "" cts 6 "Music" "Music/Ballet/Dance" puts "
" puts "" if {[llength $res] > 0} { puts "" foreach keyword $res { set kw [string range [lindex $keyword 1] 1 end] puts "" } puts "" } puts "
Keyword Searches$kw
" $db close puts "
" 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 {$term ne ""} { set records [epg fetch $cmd -extra $term] } puts { } 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] { altrow puts "" puts "" puts "" puts [$record cell] puts "" puts "" flush stdout } puts "
Date Channel Programme Synopsis
[clock format [$record get start] -format "%a %d %b %Y"]
[clock format [$record get start] -format "%H:%M %Z"]
[$record get channel_num] [$record get channel_name] [$record get text][$record get warning]
" if {$term != ""} { puts " " } epg cleanup source /mod/var/mongoose/html/lib/footer.jim