diff --git a/CONTROL/control b/CONTROL/control
index 8bfd077..9318728 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
-Version: 1.2.3-5
+Version: 1.2.4
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
-Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>2.0.3-3),auto-unprotect(>=2.0.0-1)
+Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.5),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7)
Suggests:
Description: An evolving web interface for the Humax.
-Tags: http://hummy.tv/forum/threads/5866/
+Tags: http://hummy.tv/forum/threads/6484/
diff --git a/webif/cgi-bin/idle.jim b/webif/cgi-bin/idle.jim
new file mode 100755
index 0000000..dd544f6
--- /dev/null
+++ b/webif/cgi-bin/idle.jim
@@ -0,0 +1,28 @@
+#!/mod/bin/jimsh
+
+source /mod/webif/lib/setup
+require system.class
+
+httpheader
+
+set idle [system idletime]
+if {$idle > 0} {
+ lassign [clock format $idle -format {%H %M}] h m
+ set s "Idle: "
+# switch $h {
+# 1 { append s "1 hour, " }
+# 0 {}
+# default { append s "$($h + 0) hours, " }
+# }
+# switch $m {
+# 1 { append s "1 min" }
+# default { append s "$($m + 0) mins" }
+# }
+
+ if {$h > 0} { append s "$($h + 0)h, " }
+ append s "$($m + 0)m"
+ puts $s
+} else {
+ puts ""
+}
+
diff --git a/webif/cgi-bin/status.jim b/webif/cgi-bin/status.jim
index 3400b6c..48cae18 100755
--- a/webif/cgi-bin/status.jim
+++ b/webif/cgi-bin/status.jim
@@ -75,7 +75,7 @@ proc get_data {} {
}
}
}
- if {$opfile ne "" && $opfile ni $ret} {
+ if {$opfile ne "" && $opfile ni $ret && [file exists $opfile]} {
set ret($opfile) [file size $opfile]
}
}
@@ -241,15 +241,17 @@ if {![system instandby] && $play < 1} {
}
if {$runmode eq "cgi"} {
- lappend output [concat \
- "\n" \
- " [epg channelicon $name 30 \
- {vertical-align: middle; padding: 0 4px 0 2px}]\n" \
- " Watching $lcn: $name $prog\n" \
- "\n" \
- ]
+ set s "
+
+ [epg channelicon $name 30 \
+ {vertical-align: middle; padding: 0 4px 0 2px}]
+ Watching $lcn: $name $prog
+ "
+ append s ""
+ lappend output $s
} else {
- lappend output "Watching $lcn: $name $prog"
+ set s "Watching $lcn: $name $prog"
+ lappend output $s
}
}
}
@@ -298,6 +300,13 @@ foreach event $events {
}
}
+######################################################################
+# Idle Time
+
+if {$runmode ne "cgi"} {
+ lappend output "Idle: [clock format [system idletime] -format %T]"
+}
+
######################################################################
# Output
diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim
index 9678d8c..2beb0f5 100755
--- a/webif/html/browse/index.jim
+++ b/webif/html/browse/index.jim
@@ -40,6 +40,8 @@ set nofcount [$config nounwatchedcount]
set model [system model]
set dustbin [system dustbin 1]
+set dlnaok [system dlnastatus]
+
proc icon {img {hover ""} {extra ""} {class "va"}} {
puts -nonewline "
+ Note: Content Sharing is disabled on this system.
+
+ }
+}
+
puts "
diff --git a/webif/html/css/style.css b/webif/html/css/style.css
index c5d4b4d..738ee48 100644
--- a/webif/html/css/style.css
+++ b/webif/html/css/style.css
@@ -75,6 +75,15 @@ div.container .usb
top: 8px;
}
+#idletime
+{
+ position: absolute;
+ left: 50px;
+ top: 45px;
+ font-style: italic;
+ font-size: 12px;
+}
+
div.footer
{
clear: both;
@@ -239,6 +248,12 @@ pre, .pre
background: transparent;
}
+.idletime
+{
+ font-size: 70%;
+ font-style: italic;
+}
+
.filesize
{
color: #6a6aff;
diff --git a/webif/html/diag/diag.jim b/webif/html/diag/diag.jim
index 22e1bf3..22a62bc 100755
--- a/webif/html/diag/diag.jim
+++ b/webif/html/diag/diag.jim
@@ -51,6 +51,8 @@ puts {
+
' +
- 'Running diagnostic, please wait...')
+ .html('
' +
+ 'Running diagnostic, please wait...')
.load('rundiag.jim?diag=' + encodeURIComponent(val), function() {
$('#results').wrapInner('');
});
@@ -57,7 +69,7 @@ $('#dspace').click(function(e) {
window.location = 'dspace/index.jim';
});
-$('#reboot').button({icons:{primary:"ui-icon-power"}}).click(function(e) {
+$('#reboot').click(function(e) {
e.preventDefault();
window.location = '/restart/index.jim';
});
diff --git a/webif/html/edit/edit.jim b/webif/html/edit/edit.jim
index 4c3ca9f..f83c61b 100755
--- a/webif/html/edit/edit.jim
+++ b/webif/html/edit/edit.jim
@@ -32,6 +32,7 @@ class="ui-widget ui-corner-all">
+
diff --git a/webif/html/edit/perms.jim b/webif/html/edit/perms.jim
new file mode 100755
index 0000000..4e3fed4
--- /dev/null
+++ b/webif/html/edit/perms.jim
@@ -0,0 +1,25 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/webif/lib/setup
+require pretty_size
+
+cgi_input
+#cgi_dump
+
+set file [cgi_get file "/tmp/hosts"]
+if {$file eq "-"} { exit }
+
+httpheader "text/plain" 0
+
+if {[cgi_get op "-"] eq "x"} {
+ exec chmod +x $file
+}
+
+if {![file exists $file]} {
+ puts 0
+} else {
+ set stat [file stat $file]
+ puts $($stat(mode) & 0x1ff)
+}
+
diff --git a/webif/html/edit/script.js b/webif/html/edit/script.js
index c068b18..e5dc512 100644
--- a/webif/html/edit/script.js
+++ b/webif/html/edit/script.js
@@ -4,12 +4,19 @@ var forcefile = false;
$(function() {
var file = null;
+var perms = 0;
var changed = false;
$('button').button();
$('button.editactive').disable();
$('#editor').tabsupport().disable();
+$('#open').button({icons: {primary: "ui-icon-folder-open"}});
+$('#revert').button({icons: {primary: "ui-icon-refresh"}});
+$('#save').button({icons: {primary: "ui-icon-disk"}});
+$('#create').button({icons: {primary: "ui-icon-plus"}});
+$('#executable').button({icons: {primary: "ui-icon-gear"}});
+
function loadfile(f)
{
if (!f)
@@ -18,7 +25,7 @@ function loadfile(f)
$('button.editactive').disable();
$('#editor').disable().val('');
$('#msg').text('Loading ' + f);
- $.get('get.jim?file=' + encodeURIComponent(f), function(data) {
+ $.get('get.jim', { file: f }, function(data) {
if (data.match('>>>.*does not exist'))
{
$('#msg').text(data);
@@ -40,6 +47,15 @@ function loadfile(f)
$('#msg').html('Editing ' + f + '');
file = f;
changed = false;
+
+ $.get('perms.jim', { file: f }, function(data) {
+ perms = data;
+ if (data & 0x49)
+ {
+ $('#msg').append(' - Executable');
+ $('#executable').disable();
+ }
+ });
}
});
}
@@ -119,7 +135,7 @@ function createf_submit()
console.log('Creating: ' + f);
$('#createf').dialog('close');
- $.get('create.jim?file=' + encodeURIComponent(f), function(data) {
+ $.get('create.jim', { file: f }, function(data) {
if (data.match('^>>>'))
{
$('#msg').text(data);
@@ -158,6 +174,19 @@ $('a.qfile').on('click', function() {
loadfile($(this).text());
});
+$('#executable').on('click', function() {
+ if (!confirm('Make ' + file + ' executable?'))
+ return;
+ $.get('perms.jim', { file: file, op: 'x' }, function(data) {
+ perms = data;
+ if (data & 0x49)
+ {
+ $('#executable').disable();
+ $('#msg').append(' - Executable');
+ }
+ });
+});
+
if (forcefile)
{
loadfile(forcefile);
diff --git a/webif/html/js/topbar.js b/webif/html/js/topbar.js
index f49c7d1..c7d4ec0 100644
--- a/webif/html/js/topbar.js
+++ b/webif/html/js/topbar.js
@@ -8,3 +8,17 @@ $('#topbar a').on('click', function(e) {
e.stopPropagation();
});
+$(function() {
+
+function updateidle()
+{
+ $.get('/cgi-bin/idle.jim', function(idle) {
+ $('#idletime').html(idle);
+ });
+}
+
+updateidle();
+setInterval(updateidle, 60000);
+
+});
+
diff --git a/webif/html/lib/topbar.jim b/webif/html/lib/topbar.jim
index de278bd..340db6d 100644
--- a/webif/html/lib/topbar.jim
+++ b/webif/html/lib/topbar.jim
@@ -28,6 +28,7 @@ if {[system model] eq "HDR" && [system usbdisks] > 0} {
source /mod/webif/include/usbeject.jim
}
puts {
+
}
source /mod/webif/include/toolbar.jim
diff --git a/webif/html/play/play.jim b/webif/html/play/play.jim
index 7f4a22f..67d9fe6 100755
--- a/webif/html/play/play.jim
+++ b/webif/html/play/play.jim
@@ -13,11 +13,11 @@ if {[catch {$ts get file}]} {
exit
}
-if {![$ts flag "ODEncrypted"]} {
- set url $rfile
-} else {
- lassign [$ts dlnaloc] url
- if {$url eq ""} {
+lassign [$ts dlnaloc] url
+if {$url eq ""} {
+ if {![$ts flag "ODEncrypted"]} {
+ set url $rfile
+ } else {
puts "Media is encrypted and not indexed by the DLNA Server."
exit
}
diff --git a/webif/lib/bin/auto b/webif/lib/bin/auto
index b0e5728..b24614f 100755
--- a/webif/lib/bin/auto
+++ b/webif/lib/bin/auto
@@ -135,13 +135,13 @@ eval_plugins auto 1
set scanstart [clock milliseconds]
log "-------------------------------------------------------"
-# is_listening is relatively expensive so it is checked once globally at
+# dlnastatus is relatively expensive so it is checked once globally at
# the start and then if the server is not listening then no decrypt
# operations will be attempted for this run, even if the server starts
# up halfway through. Otherwise the server is checked for every decryption
# and if it goes away then decryption will not be attempted for the rest
# of the run.
-if {[system is_listening 9000]} {
+if {[system dlnastatus]} {
set dlnaok 1
log "DLNA Server is running." 2
} else {
@@ -333,7 +333,7 @@ proc do_decrypt {ts} {
return
}
- if {![system is_listening 9000]} {
+ if {![system dlnastatus]} {
log " $file - DLNA Server not running." 2
set ::dlnaok 0
return
@@ -445,6 +445,7 @@ proc do_decrypt {ts} {
}
log "Done... [endclock $size]" 0
lappend processed_files [$ts get file]
+ $ts unflag "ODEncrypted"
runplugin postdecrypt $ts
endop
}
diff --git a/webif/lib/system.class b/webif/lib/system.class
index 23599a0..839db4c 100644
--- a/webif/lib/system.class
+++ b/webif/lib/system.class
@@ -74,6 +74,13 @@ proc {system lastbootreason} {{descr 1}} {{lbr -1}} {
return "Unknown ($lbr)"
}
+proc {system idletime} {} {
+ if {[file exists "/tmp/.lastir"]} {
+ return $([clock seconds] - [file mtime "/tmp/.lastir"])
+ }
+ return 0
+}
+
proc {system fhtcpversion} {} {{ver ""}} {
if {$ver ne ""} { return $ver }
set file "/etc/fhtcpversion"
@@ -153,6 +160,10 @@ proc {system mediaroot} {} {
return ""
}
+proc {system dlnastatus} {} {
+ return [system is_listening 9000]
+}
+
proc {system dlnadb} {} {
switch [system model] {
HDR { return "/mnt/hd2/dms_cds.db" }
@@ -163,7 +174,9 @@ proc {system dlnadb} {} {
proc {system _dlnaurl} {file urlbase} {
set mime "video/ts"
- set db [sqlite3.open [system dlnadb]]
+ if {[catch {set db [sqlite3.open [system dlnadb]]}]} {
+ return {}
+ }
set muri [$db query {
select tblresource.mimetype, contenturi
from tblresource join tblmedia using (mediaid)
@@ -300,11 +313,17 @@ proc {system diskspace} {{raw 0}} {
set fperc $(100 - $perc)
switch [system model] {
- HDR { set tsrdir "/mnt/hd2/Tsr" }
- HD { set tsrdir "/media/drive1/.tsr" }
+ HDR {
+ set tsrdir "/mnt/hd2/Tsr"
+ set tsrok [file isdirectory $tsrdir]
+ }
+ HD {
+ set tsrdir "/media/drive1/.tsr"
+ set tsrok [file exists "$tsrdir/0.ts"]
+ }
}
- if {[file exists "$tsrdir/0.ts"]} {
+ if {$tsrok} {
set tsrbuf 21474836480
lassign [exec du -ks $tsrdir] tsrused
set tsrused $($tsrused * 1024)
diff --git a/webif/lib/ts.class b/webif/lib/ts.class
index dbc7849..74967d7 100644
--- a/webif/lib/ts.class
+++ b/webif/lib/ts.class
@@ -87,6 +87,10 @@ ts method flag {f} {
if {$f in $flags} {return 1} else {return 0}
}
+ts method unflag {f} {
+ lremove flags $f
+}
+
ts method unlock {} {
set cmd [list /mod/bin/hmt -lock $file]
exec {*}$cmd