restructure requires, add initial plugin class and hook into settings

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@220 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg
2011-07-01 22:56:53 +00:00
parent 9116c6e8a9
commit d1cfff8899
17 changed files with 92 additions and 68 deletions

View File

@@ -4,8 +4,8 @@ Section: web
Version: 0.5.8
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=2.11-5),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.2),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.2),hmt(>=1.0.6),ssmtp
Depends: mongoose(>=2.11-6),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.3),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.2),hmt(>=1.0.6),ssmtp
Replaces: af123-webif
Conflicts: af123-webif
Suggests: ffmpeg
Description: A web interface for the Humax. In development.
Description: An evolving web interface for the Humax.

View File

@@ -1,8 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/var/mongoose/lib/pretty_size
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html"
puts ""
@@ -154,7 +154,7 @@ if {[dict exists $_cgi dir]} {
######################################################################
# Render web page
source /mod/var/mongoose/html/lib/header.jim
header
puts {
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
@@ -246,5 +246,5 @@ foreach file [lsort [glob -nocomplain "$dir"]] {
puts "</fieldset>"
source /mod/var/mongoose/html/lib/footer.jim
footer

View File

@@ -39,7 +39,7 @@ function set_folder_new(folder, cnt)
{
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
console.log("Folder: (%s) = (%s)", folder, cnt);
//console.log("Folder: (%s) = (%s)", folder, cnt);
$('#img' + folder).attr('src', '/img/Folder_New.png');
}

View File

@@ -1,12 +1,13 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/setup
require epg.class
puts "Content-Type: text/html"
puts ""
source /mod/var/mongoose/html/lib/header.jim
header
cgi_input
#cgi_dump
@@ -31,5 +32,6 @@ if { $raw == 0 } {
puts "</pre>"
epg cleanup
source /mod/var/mongoose/html/lib/footer.jim
footer

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/setup
require epg.class
puts "Content-Type: text/html"
puts ""
@@ -13,9 +14,7 @@ set service 0
catch { set service [dict get $_cgi service] }
set event 0
catch { set event [dict get $_cgi event] }
if {! [dict exists $_cgi bare]} {
source /mod/var/mongoose/html/lib/header.jim
}
if {! [dict exists $_cgi bare]} { header }
#set service 8384
#set event 25293
@@ -105,7 +104,5 @@ puts "
"
epg cleanup
if {! [dict exists $_cgi bare]} {
source /mod/var/mongoose/html/lib/footer.jim
}
if {! [dict exists $_cgi bare]} { footer }

View File

@@ -1,14 +1,13 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/spinner.class
source /mod/var/mongoose/lib/altrow
source /mod/var/mongoose/lib/setup
require epg.class spinner.class altrow
puts "Content-Type: text/html"
puts ""
source /mod/var/mongoose/html/lib/header.jim
header
puts "<script type=text/javascript src=/js/highlight.js></script>"
@@ -36,7 +35,7 @@ if {[dict exists $_cgi term]} {
set _cgi(term) "SCRID:$scrid"
}
source /mod/var/mongoose/lib/epg_search
require epg_search
[spinner new {
text "Searching EPG..."
@@ -44,7 +43,7 @@ source /mod/var/mongoose/lib/epg_search
style "margin: 1em;"
}] start
source /mod/var/mongoose/lib/epg_popup
require epg_popup
#set _cgi [dict create term "doctor who"]
#set env(REQUEST_URI) "test"
@@ -122,5 +121,5 @@ if {$searchterm != ""} {
}
epg cleanup
source /mod/var/mongoose/html/lib/footer.jim
footer

View File

@@ -1,15 +1,13 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/spinner.class
source /mod/var/mongoose/lib/altrow
source /mod/var/mongoose/lib/cat
source /mod/var/mongoose/lib/setup
require epg.class spinner.class altrow
puts "Content-Type: text/html"
puts ""
source /mod/var/mongoose/html/lib/header.jim
header
[spinner new {
text "Loading EPG Data..."
@@ -20,7 +18,7 @@ source /mod/var/mongoose/html/lib/header.jim
cgi_input
#cgi_dump
source /mod/var/mongoose/lib/epg_popup
require epg_popup
set service 0
set service 4351
@@ -72,5 +70,5 @@ foreach record $records {
puts "</table>"
epg cleanup
source /mod/var/mongoose/html/lib/footer.jim
footer

View File

@@ -1,7 +1,9 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/settings.class
package require cgi
source /mod/var/mongoose/lib/setup
require settings.class
require plugin
puts "Content-Type: text/html"
puts ""
@@ -17,8 +19,7 @@ set channel_group [$settings channel_group]
# Handle updates
#set _cgi(smtp_server) "fred.bob"
#set env(REQUEST_URI) ''
if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" }
proc _handle_update {class var old text} {
global _cgi
@@ -50,7 +51,8 @@ handle_str_update hostname $hostname Hostname
_handle_update ascii smtp_server $smtp_server "SMTP Server"
handle_int_update channel_group $channel_group "Channel Group"
source /mod/var/mongoose/html/lib/header.jim
header
puts {<script type="text/javascript" src="/js/jquery.form.js"></script>}
puts {
@@ -60,7 +62,7 @@ puts {
<script type=text/javascript>
$(document).ready(function () {
$(":submit").button();
$('form').each(function(i, el) {
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
$(this).ajaxForm({
@@ -86,7 +88,7 @@ puts "
puts "
<tr>
<form id=hostname method=get action=$env(REQUEST_URI)>
<form class=auto id=hostname method=get action=$env(REQUEST_URI)>
<th class=key>Hostname</th>
<td><input name=hostname value=\"$hostname\"
class=\"text ui-widget-content ui-corner-all\"
@@ -100,7 +102,7 @@ puts "
puts "
<tr>
<form id=channel_group method=get action=$env(REQUEST_URI)>
<form class=auto id=channel_group method=get action=$env(REQUEST_URI)>
<th class=key>Channel Group for EPG</th>
<td><select id=channel_group name=channel_group
class=\"text ui-widget-content ui-corner-all\"
@@ -138,7 +140,7 @@ puts "
puts "
<tr>
<form id=smtp_server method=get action=$env(REQUEST_URI)>
<form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
<th class=key>SMTP Server for outbound email</th>
<td><input name=smtp_server value=\"$smtp_server\"
class=\"text ui-widget-content ui-corner-all\"
@@ -155,5 +157,7 @@ puts "
</fieldset>
"
source /mod/var/mongoose/html/lib/footer.jim
eval_plugins settings
footer

View File

@@ -3,10 +3,6 @@
puts "Content-Type: text/html"
puts ""
#puts "<img style=\"vertical-align: middle\" src=/images/745_1_11_Video_1REC.png><span style=\"vertical-align: middle\">Recording one thing</span>"
#puts "<img style=\"vertical-align: middle\" src=/images/745_1_11_Video_1REC.png><span style=\"vertical-align: middle\">Recording another thing</span>"
#puts "<img style=\"vertical-align: middle\" src=/images/745_1_10_Video_2Live.png><span style=\"vertical-align: middle\">Watching something else</span>"
if {[catch {set pid [exec pgrep humaxtv]}]} { exit }
if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} {

View File

@@ -1,8 +1,8 @@
#!/mod/bin/jimsh
package require sqlite3
source /mod/var/mongoose/lib/altrow
source /mod/var/mongoose/lib/setup
require altrow
proc db_info {db_file} {
set db [sqlite3.open $db_file]

View File

@@ -1,10 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/spinner.class
source /mod/var/mongoose/lib/altrow
source /mod/var/mongoose/lib/epg_search
source /mod/var/mongoose/lib/setup
require epg.class spinner.class altrow epg_search
[spinner new {
text "Loading Now/Next Information..."
@@ -12,7 +10,7 @@ source /mod/var/mongoose/lib/epg_search
style "margin: 1em;"
}] start
source /mod/var/mongoose/lib/epg_popup
require epg_popup
set start [clock milliseconds]
set records [epg fetch dump -time [clock seconds]]

View File

@@ -1,6 +1,7 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/pkg.class
source /mod/var/mongoose/lib/setup
require pkg.class
puts {

View File

@@ -2,7 +2,8 @@
package require sqlite3
source /mod/var/mongoose/lib/altrow
source /mod/var/mongoose/lib/setup
require altrow
set db [sqlite3.open /var/lib/humaxtv/rsv.db]
$db query {attach database '/var/lib/humaxtv/channel.db' as channel}

View File

@@ -1,19 +1,18 @@
source /mod/var/mongoose/lib/setup
if {[expr ! [exists -proc class ]]} { package require oo }
if {[expr ! [exists -proc sqlite3.open ]]} { package require sqlite3 }
if {[expr ! [exists -proc settings ]]} {
source /mod/var/mongoose/lib/settings.class
}
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc settings ]} { require settings.class }
source /mod/var/mongoose/lib/progressbar
require progressbar
set channeldb 0
catch { set channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
set ::channeldb 0
catch { set ::channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
set epgpath /mnt/hd1/dvbepg/epg.dat
set hdepgpath /media/drive1/epgsavedata
if {![file exists $epgpath] && [file exists $hdepgpath]} {
set epgpath $hdepgpath
set ::epgpath /mnt/hd1/dvbepg/epg.dat
set ::hdepgpath /media/drive1/epgsavedata
if {![file exists $::epgpath] && [file exists $::hdepgpath]} {
set ::epgpath $::hdepgpath
}
# * service_id, event_id, start, duration, encrypted, name, text
@@ -265,3 +264,15 @@ proc {epg favlist} {} {
"] { lindex $i end }]
}
proc {epg channellist} {} {
global channeldb
set channels {}
lmap i [$channeldb query "
select usSvcid, szSvcName
from TBL_SVC
"] { set channels([string range [lindex $i 3] 1 end]) [lindex $i 1] }
return $channels
}

View File

@@ -1,6 +1,6 @@
if {[expr ! [exists -proc class ]]} { package require oo }
if {[expr ! [exists -proc sqlite3.open ]]} { package require sqlite3 }
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
set settingsdb [sqlite3.open /mod/etc/webif.db]

17
var/mongoose/lib/setup Normal file
View File

@@ -0,0 +1,17 @@
if {![exists -proc require]} {
proc require {args} {
foreach file $args {
uplevel source "/mod/var/mongoose/lib/$file"
}
}
proc header {} {
uplevel source /mod/var/mongoose/html/lib/header.jim
}
proc footer {} {
uplevel source /mod/var/mongoose/html/lib/footer.jim
}
}

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc class ]]} { package require oo }
if {![exists -proc class ]} { package require oo }
class ts {
file ""