From 1d44efdcdcacaf29c35a9af037cf5dbc74099cf6 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 9 Sep 2011 19:38:37 +0000 Subject: [PATCH] add channel info page git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@381 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/channel.jim | 113 +++++++++++++++++++++++++++++++ var/mongoose/cgi-bin/db.jim | 23 +++++-- var/mongoose/html/index.shtml | 2 + var/mongoose/include/sched.jim | 5 +- 5 files changed, 136 insertions(+), 9 deletions(-) create mode 100755 var/mongoose/cgi-bin/channel.jim diff --git a/CONTROL/control b/CONTROL/control index cf14d77..9f4847e 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.6.8-3 +Version: 0.6.9 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.3),hmt(>=1.0.6),ssmtp diff --git a/var/mongoose/cgi-bin/channel.jim b/var/mongoose/cgi-bin/channel.jim new file mode 100755 index 0000000..cf54933 --- /dev/null +++ b/var/mongoose/cgi-bin/channel.jim @@ -0,0 +1,113 @@ +#!/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] + puts "" + puts "" + puts " + " +} + +puts "
ChannelFrequencySignal StrengthSignal QualityChannels
[f2c $ulFrequency][expr $ulFrequency / 1000.0] MHz[progressbar $ucLevel][progressbar $ucQuality][llength $channels] + + + view +
" + 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 "
ChannelProviderAuthority
" + puts "[epg channelicon $name 50]$lcn$name" + puts $prv + puts "" + puts $auth + puts "
" + puts "
" + +puts { + +} + diff --git a/var/mongoose/cgi-bin/db.jim b/var/mongoose/cgi-bin/db.jim index 4149264..b0a429b 100755 --- a/var/mongoose/cgi-bin/db.jim +++ b/var/mongoose/cgi-bin/db.jim @@ -8,6 +8,14 @@ require altrow puts "Content-Type: text/html" puts "" +set databases { + /var/lib/humaxtv/rsvp.db + /var/lib/humaxtv/rsv.db + /var/lib/humaxtv/setup.db + /var/lib/humaxtv/channel.db + /mnt/hd2/dms_cds.db +} + header cgi_input @@ -62,11 +70,16 @@ proc db_info {db_file} { $db close } -db_info /var/lib/humaxtv/rsvp.db -db_info /var/lib/humaxtv/rsv.db -db_info /var/lib/humaxtv/setup.db -db_info /var/lib/humaxtv/channel.db -db_info /mnt/hd2/dms_cds.db +if {$fdb == 0} { + puts "Please choose database to view:" +} else { + foreach db $databases { db_info $db } +} footer diff --git a/var/mongoose/html/index.shtml b/var/mongoose/html/index.shtml index 6c8f2b1..2e9d552 100644 --- a/var/mongoose/html/index.shtml +++ b/var/mongoose/html/index.shtml @@ -111,6 +111,8 @@ $(document).ready(function() {