quick edit, cli status, db.jim
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1164 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
c149d7ae3c
commit
b691be415a
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.9.14
|
||||
Version: 0.9.14-1
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2)
|
||||
|
1
bin/status
Symbolic link
1
bin/status
Symbolic link
@ -0,0 +1 @@
|
||||
../webif/cgi-bin/status.jim
|
@ -95,10 +95,14 @@ function insert_folder_size(folder, size)
|
||||
folder = folder.replace(/ /g, '');
|
||||
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
||||
//console.log("Folder: (%s) = (%s)", folder, size);
|
||||
if (folder == "")
|
||||
$('#dirsize').text(' (' + size + 'iB)');
|
||||
if (size.search(/\d$/) == -1)
|
||||
size += 'iB';
|
||||
else
|
||||
$('#' + folder).text(' (' + size + 'iB)');
|
||||
size += ' bytes';
|
||||
if (folder == "")
|
||||
$('#dirsize').text(' (' + size + ')');
|
||||
else
|
||||
$('#' + folder).text(' (' + size + ')');
|
||||
}
|
||||
|
||||
function folder_size_callback(data, status, xhr)
|
||||
|
@ -1,80 +1,23 @@
|
||||
#!/mod/bin/jimsh
|
||||
#!/bin/sh
|
||||
|
||||
package require cgi
|
||||
package require sqlite3
|
||||
source /mod/webif/lib/setup
|
||||
require altrow
|
||||
PATH=$PATH:/mod/bin export PATH
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo ""
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
[ -n "$QUERY_STRING" ] && data="${QUERY_STRING##*=}" || data=epg
|
||||
|
||||
set databases [glob /var/lib/humaxtv/*.db]
|
||||
lappend databases "/mnt/hd2/dms_cds.db"
|
||||
case $data in
|
||||
channels)
|
||||
sqlite3 -header -batch -separator ' ' \
|
||||
/var/lib/humaxtv/channel.db '
|
||||
select * from TBL_SVC;
|
||||
'
|
||||
;;
|
||||
|
||||
header
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
*) /mod/bin/epg -p dump ;;
|
||||
esac
|
||||
|
||||
set ftab [cgi_get tab]
|
||||
set fdb [cgi_get db]
|
||||
|
||||
if {$fdb != 0} {
|
||||
puts "<h1><a href=/cgi-bin/db.jim>Remove filters</a></h1>"
|
||||
}
|
||||
|
||||
proc db_info {db_file} {
|
||||
global _cgi fdb ftab
|
||||
|
||||
if {$fdb != 0 && [file tail $db_file] ne $fdb} { return }
|
||||
if {![file exists $db_file]} { return }
|
||||
|
||||
set db [sqlite3.open $db_file]
|
||||
set tables [$db query {
|
||||
select name from sqlite_master
|
||||
where type='table' order by name
|
||||
}]
|
||||
|
||||
puts "<h1><a href=/cgi-bin/db.jim?db=[file tail $db_file]>
|
||||
$db_file</a></h1>"
|
||||
|
||||
foreach table $tables {
|
||||
set table [lindex $table 1]
|
||||
if {$ftab != 0 && $ftab ne $table} { continue }
|
||||
set columns [$db query "pragma table_info($table)"]
|
||||
set datas [$db query "SELECT * FROM $table order by 1"]
|
||||
|
||||
puts "<h2><a href=/cgi-bin/db.jim?db=[file tail $db_file]&tab=$table>$table</a></h2>"
|
||||
puts "<table class=borders>"
|
||||
puts " <tr>"
|
||||
foreach column $columns {
|
||||
puts " <th>[lindex $column 3]</th>"
|
||||
}
|
||||
puts " </tr>"
|
||||
foreach data $datas {
|
||||
altrow
|
||||
|
||||
for {set i 1} {$i < [llength $data]} {incr i 2} {
|
||||
puts " <td>[lindex $data $i]</td>"
|
||||
}
|
||||
puts " </tr>"
|
||||
}
|
||||
puts "</table>"
|
||||
}
|
||||
|
||||
$db close
|
||||
}
|
||||
|
||||
if {$fdb == 0} {
|
||||
puts "Please choose database to view:<ul>"
|
||||
foreach db $databases {
|
||||
puts "<li><a href=$::env(REQUEST_URI)?db=[file tail $db]>
|
||||
$db</a></li>"
|
||||
}
|
||||
puts "</ul>"
|
||||
} else {
|
||||
foreach db $databases { db_info $db }
|
||||
}
|
||||
|
||||
footer
|
||||
exit 0
|
||||
|
||||
|
@ -1,12 +1,22 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
cgi_input
|
||||
|
||||
set type [cgi_get type "full"]
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
}
|
||||
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
@ -40,7 +50,12 @@ set rec 0
|
||||
set seen {}
|
||||
set output {}
|
||||
|
||||
set data [get_data]
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
} else {
|
||||
set data {}
|
||||
}
|
||||
|
||||
if {[llength $data]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
@ -64,8 +79,12 @@ if {[llength $data]} {
|
||||
|
||||
incr seen($name)
|
||||
|
||||
lappend output "<img class=va src=/images/$icon><span class=va>
|
||||
$mode <i>$name</i></span>"
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output "<img class=va src=/images/$icon>
|
||||
<span class=va>$mode <i>$name</i></span>"
|
||||
} else {
|
||||
lappend output "$mode $name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,20 +113,33 @@ if {![system instandby] && $play < 1} {
|
||||
append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
|
||||
append prog ") \[[$epg percent]%\]"
|
||||
}
|
||||
|
||||
lappend output "[epg channelicon $name 30 \
|
||||
{vertical-align: middle; padding: 0 4px 0 2px}]
|
||||
<span class=va> Watching <i>$lcn: $name $prog</i></span>"
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output "[epg channelicon $name 30 \
|
||||
{vertical-align: middle; padding: 0 4px 0 2px}]
|
||||
<span class=va>
|
||||
Watching <i>$lcn: $name $prog</i></span>"
|
||||
} else {
|
||||
lappend output "Watching $lcn: $name $prog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[system instandby]} {
|
||||
lappend output "<img class=va width=28 style=\"padding: 0 4px\"
|
||||
src=/img/standby.png>
|
||||
<span class=va>System is in standby.</span>"
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output "<img class=va width=28 style=\"padding: 0 4px\"
|
||||
src=/img/standby.png>
|
||||
<span class=va>System is in standby.</span>"
|
||||
} else {
|
||||
lappend output "System is in standby."
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $output]} {
|
||||
puts [join $output "<br>"]
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "<br>"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,16 @@ Use the <i>Open</i> button below to begin.
|
||||
<button id=back>Back to diagnostics</button>
|
||||
</div>
|
||||
|
||||
<div class=cleft style="margin-top: 1em">
|
||||
<fieldset>
|
||||
<legend> Commonly edited files </legend>
|
||||
<ul>
|
||||
<li><a href=# class=qfile>/mod/etc/anacrontab</a></li>
|
||||
<li><a href=# class=qfile>/mod/var/spool/cron/crontabs/root</a></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id=chooserd>
|
||||
<i>Humax Filesystem</i>
|
||||
<div id=chooser></div>
|
||||
|
@ -144,4 +144,8 @@ $('#create').click(function() {
|
||||
$('#createf').dialog('open');
|
||||
});
|
||||
|
||||
$('a.qfile').on('click', function() {
|
||||
loadfile($(this).text());
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user