From 01b067bdeb38512f8d9e518ad151d117e15c1196 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 7 Jun 2011 14:45:01 +0000 Subject: [PATCH] updates for running under apache git-svn-id: file:///root/webif/svn/humax/pkg/src/webif@162 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/cgi-bin/status.jim | 7 ++++--- var/mongoose/html/db.shtml | 2 +- var/mongoose/html/epg.shtml | 2 +- var/mongoose/html/index.shtml | 7 +++++-- var/mongoose/html/lib/footer.shtml | 2 +- var/mongoose/html/lib/topbar.shtml | 2 +- var/mongoose/html/packages.shtml | 2 +- var/mongoose/html/sched.shtml | 2 +- var/mongoose/html/services.shtml | 2 +- var/mongoose/include/diskspace.jim | 20 +++++++++++++------- var/mongoose/lib/epg.class | 19 ++++++++++++------- 11 files changed, 41 insertions(+), 26 deletions(-) diff --git a/var/mongoose/cgi-bin/status.jim b/var/mongoose/cgi-bin/status.jim index ce17849..2c580bc 100755 --- a/var/mongoose/cgi-bin/status.jim +++ b/var/mongoose/cgi-bin/status.jim @@ -1,6 +1,9 @@ #!/mod/bin/jimsh -set pid [exec pgrep humaxtv] +puts "Content-Type: text/html" +puts "" + +if {[catch {set pid [exec pgrep humaxtv]}]} { exit } if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} { exit @@ -40,8 +43,6 @@ foreach line $lines { } if {[llength $output]} { - puts "Content-Type: text/html" - puts "" puts [join $output "
\n"] } diff --git a/var/mongoose/html/db.shtml b/var/mongoose/html/db.shtml index 4fe6b71..9fa5fb8 100644 --- a/var/mongoose/html/db.shtml +++ b/var/mongoose/html/db.shtml @@ -1,4 +1,4 @@ - + diff --git a/var/mongoose/html/epg.shtml b/var/mongoose/html/epg.shtml index 51c2e4a..69b819d 100644 --- a/var/mongoose/html/epg.shtml +++ b/var/mongoose/html/epg.shtml @@ -4,6 +4,6 @@ Search EPG: Search descriptions as well as titles. - + diff --git a/var/mongoose/html/index.shtml b/var/mongoose/html/index.shtml index cd1c6b8..9c766ca 100644 --- a/var/mongoose/html/index.shtml +++ b/var/mongoose/html/index.shtml @@ -17,9 +17,12 @@ function updateResults() var r = document.getElementById('status'); if (r && request.readyState == 4 && request.status == 200) { - r.style.display = 'block'; var t = document.getElementById('status_txt'); - t.innerHTML = request.responseText; + if (t.length) + { + r.style.display = 'block'; + t.innerHTML = request.responseText; + } } } diff --git a/var/mongoose/html/lib/footer.shtml b/var/mongoose/html/lib/footer.shtml index 850397d..5a20624 100644 --- a/var/mongoose/html/lib/footer.shtml +++ b/var/mongoose/html/lib/footer.shtml @@ -1,7 +1,7 @@
diff --git a/var/mongoose/html/packages.shtml b/var/mongoose/html/packages.shtml index 79369ca..b4c35f1 100644 --- a/var/mongoose/html/packages.shtml +++ b/var/mongoose/html/packages.shtml @@ -9,6 +9,6 @@ Results... - + diff --git a/var/mongoose/html/sched.shtml b/var/mongoose/html/sched.shtml index 4cd719d..c88231a 100644 --- a/var/mongoose/html/sched.shtml +++ b/var/mongoose/html/sched.shtml @@ -1,4 +1,4 @@ - + diff --git a/var/mongoose/html/services.shtml b/var/mongoose/html/services.shtml index e529643..af8b30d 100644 --- a/var/mongoose/html/services.shtml +++ b/var/mongoose/html/services.shtml @@ -53,6 +53,6 @@ Results... Auto Startup Status - + diff --git a/var/mongoose/include/diskspace.jim b/var/mongoose/include/diskspace.jim index 078a172..b464fcf 100755 --- a/var/mongoose/include/diskspace.jim +++ b/var/mongoose/include/diskspace.jim @@ -1,12 +1,18 @@ #!/mod/bin/jimsh -foreach df [split [exec df -h] "\n\r"] { - if [string match *sda2* $df] { - regsub -all -- {[[:space:]]+} $df " " df - set fields [split $df] - set size [lindex $fields 1] - set used [lindex $fields 2] - set perc [string trimright [lindex $fields 4] "%"] +if {[os.gethostname] eq "hosting"} { + set size "1TB" + set used "100GB" + set perc "10" +} else { + foreach df [split [exec df -h] "\n\r"] { + if [string match *sda2* $df] { + regsub -all -- {[[:space:]]+} $df " " df + set fields [split $df] + set size [lindex $fields 1] + set used [lindex $fields 2] + set perc [string trimright [lindex $fields 4] "%"] + } } } diff --git a/var/mongoose/lib/epg.class b/var/mongoose/lib/epg.class index 7887df6..b3e5930 100644 --- a/var/mongoose/lib/epg.class +++ b/var/mongoose/lib/epg.class @@ -4,7 +4,10 @@ if {[expr ! [exists -proc sqlite3.open ]]} { package require sqlite3 } source /mod/var/mongoose/lib/progressbar +set channeldb 0 +catch { set channeldb [sqlite3.open /var/lib/humaxtv/channel.db] +} # * service_id, event_id, start, duration, encrypted, name, text # * warning, content code, content type, @@ -143,7 +146,7 @@ proc {epg parse} {line} { proc {epg cleanup} {} { global channeldb - $channeldb close + if $channeldb { $channeldb close } } proc {epg exec} {mode args} { @@ -178,12 +181,14 @@ proc {epg fetch} {mode args} { foreach line [split [epg exec $mode {*}$args] "\n"] { set record [epg parse $line] - set chan [lindex [$channeldb query { - select szSvcName, usLcn from TBL_SVC - where usSvcId = %s} "[$record get service_id]" - ] 0] - $record channel $chan(usLcn) \ - [string range $chan(szSvcName) 1 end] + if $channeldb { + set chan [lindex [$channeldb query { + select szSvcName, usLcn from TBL_SVC + where usSvcId = %s} "[$record get service_id]" + ] 0] + $record channel $chan(usLcn) \ + [string range $chan(szSvcName) 1 end] + } lappend records $record }