#!/mod/bin/jimsh package require cgi package require sqlite3 source /mod/var/mongoose/lib/setup require altrow progressbar epg.class puts "Content-Type: text/html" puts "" header cgi_input proc f2c {frequency} { set ch int($((($frequency / 1000) - 303.25) / 8)) return [expr int($ch)] } if {[catch {set db [sqlite3.open /var/lib/humaxtv/channel.db]} msg]} { puts "Error opening channel database: $msg" exit } puts "

" foreach tw [$db query { select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality from TBL_TS order by ulFrequency }] { lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality altrow puts " " puts "" puts "" set channels [$db query { select usLcn, szSvcName, szPrvName, aucDefaultAuthority from TBL_SVC left join TBL_PRV using (prvIdx) where tsIdx = %s order by usLcn } $tsIdx] set mux "???" set ehs 0 foreach chan $channels { lassign $chan x lcn x name set name [string range $name 1 end] if {$lcn >= 800} { incr ehs } switch $name { "BBC ONE" { set mux "PSB1/BBC A" } "ITV1" { set mux "PSB2/D3&4" } "BBC One HD" { set mux "PSB3/BBC B (HD)" } "ITV3" { set mux "COM4/SDN" } "Dave" { set mux "COM5/ARQ A" } "Film4" { set mux "COM6/ARQ B" } } } puts "" puts "" puts "" puts "" } puts "
Channel Frequency Signal Strength Signal Quality Mux Channels >799
[f2c $ulFrequency] [expr $ulFrequency / 1000.0] MHz[progressbar $ucLevel][progressbar $ucQuality]$mux[llength $channels] view $ehs" puts "
" puts "" puts "" foreach chan $channels { lassign $chan x lcn x name x prv x auth set name [string range $name 1 end] set prv [string range $prv 3 end] altrow puts "" puts "" puts "" } puts "
Channel Provider Authority
" puts "[epg channelicon $name 50] $lcn$name" puts $prv puts "" puts $auth puts "
" puts "
" puts { }