From c21504b43f5b5ee6fa06b2754f5a859809f0d7b7 Mon Sep 17 00:00:00 2001
From: hummypkg <af123@hpkg.tv>
Date: Wed, 11 Jan 2017 17:18:24 +0000
Subject: [PATCH] updates

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3513 2a923420-c742-0410-a762-8d5b09965624
---
 CONTROL/control                 |  2 +-
 webif/html/browse/index.jim     |  2 ++
 webif/html/diag/queue/index.jim |  2 +-
 webif/html/diag/queue/script.js | 16 ++++++++++++++--
 webif/html/diag/queue/style.css |  8 ++++++++
 webif/lib/auto/deq              |  4 ++++
 webif/lib/auto/scan             |  2 ++
 7 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/CONTROL/control b/CONTROL/control
index 091017c..574f4aa 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,7 +1,7 @@
 Package: webif
 Priority: optional
 Section: web
-Version: 1.3.5-4
+Version: 1.3.5-5
 Architecture: mipsel
 Maintainer: af123@hpkg.tv
 Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.5),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.9),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1)
diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim
index 4bf8704..4577e69 100755
--- a/webif/html/browse/index.jim
+++ b/webif/html/browse/index.jim
@@ -31,6 +31,8 @@ if {![dict exists $env SCRIPT_NAME]} {
 
 if {![dict exists $env QUERY_STRING]} { set env(QUERY_STRING) "root" }
 
+set dir [string map [list "\{root\}" $mroot] $dir]
+
 set config [settings new]
 
 set order [cgi_get order -]
diff --git a/webif/html/diag/queue/index.jim b/webif/html/diag/queue/index.jim
index 51cdb37..25f26dd 100755
--- a/webif/html/diag/queue/index.jim
+++ b/webif/html/diag/queue/index.jim
@@ -51,7 +51,7 @@ There are no tasks in the queue.
 <button id=refresh>Refresh</button>
 <span id=isloading><img src=/img/loading.gif></span>
 </div>
-<div class=blood>Last scan: <span id=autolast>retrieving...</span> -
+<div id=lastscan>Last media scan: <span id=autolast>retrieving...</span> -
 scanning every <span id=autofreq>TBC</span> minutes.</div>
 </fieldset>
 }
diff --git a/webif/html/diag/queue/script.js b/webif/html/diag/queue/script.js
index 433f5a1..ae4c047 100644
--- a/webif/html/diag/queue/script.js
+++ b/webif/html/diag/queue/script.js
@@ -8,6 +8,11 @@ function page_refresh(msg)
         window.location.reload(true);
 }
 
+function dirname(path)
+{
+	return path.replace(/\/[^\/]*$/, '');
+}
+
 function load()
 {
 	$('#isloading').show();
@@ -26,7 +31,7 @@ function load()
 	    ' value=' + v.qid + '>' +
 	    v.qid + '</td>' +
 	'<td>' + v.submitted + '</td>' +
-	'<td>' + v.file + '</td>' +
+	'<td><a href=# class=file>' + v.file + '</a></td>' +
 	'<td>' + v.action + ' ' + v.args + '</td>' +
 	'<td class="status ' + v.status + '">' + v.status;
 	if (v.status == 'RUNNING')
@@ -37,7 +42,7 @@ function load()
 	if (v.runtime != '0')
 		s += v.runtime;
 	s += '</td>' +
-	'<td>' + v.log + '</td>' +
+	'<td class=queuelog>' + v.log + '</td>' +
 	'<td>' + v.last + '</td>' +
 	'</tr>';
 
@@ -145,6 +150,13 @@ $('#refresh').button({icons:{primary:"ui-icon-refresh"}})
 	load();
 });
 
+$('#queuetab').on('click', 'a.file', function(e) {
+	e.preventDefault();
+	file = $(this).html();
+	window.location = '/go/browse?dir=' +
+	    encodeURIComponent('{root}/' + dirname(file));
+});
+
 setInterval(load, 60000);
 
 });
diff --git a/webif/html/diag/queue/style.css b/webif/html/diag/queue/style.css
index da9cdce..37c4fe7 100644
--- a/webif/html/diag/queue/style.css
+++ b/webif/html/diag/queue/style.css
@@ -37,3 +37,11 @@ div#loading, div#nodata
 	color: #ff4000;
 }
 
+#lastscan
+{
+	color: #ccc;
+	background: transparent;
+	font-style: italic;
+	padding-top: 2px;
+}
+
diff --git a/webif/lib/auto/deq b/webif/lib/auto/deq
index 8c142b4..e853df4 100755
--- a/webif/lib/auto/deq
+++ b/webif/lib/auto/deq
@@ -125,6 +125,8 @@ proc ::auto::runplugin {plugin fn args} {
 	if {![exists -proc $rfn]} { return -1 }
 	if {[catch {set ret [uplevel 1 $rfn {*}$args]} msg]} {
 		log "$rfn: $msg" 0
+		lassign [info stacktrace] p f l
+		log "    $f:$l @ $p" 0
 		return -1
 	}
 	return $ret
@@ -136,6 +138,8 @@ proc ::auto::runplugins {fn args} {
 		if {![exists -proc $rfn]} continue
 		if {[catch {uplevel 1 $rfn {*}$args} msg]} {
 			log "$rfn: $msg" 0
+			lassign [info stacktrace] p f l
+			log "    $f:$l @ $p" 0
 		}
 	}
 }
diff --git a/webif/lib/auto/scan b/webif/lib/auto/scan
index 6db7faa..d1df8c2 100755
--- a/webif/lib/auto/scan
+++ b/webif/lib/auto/scan
@@ -372,6 +372,8 @@ proc ::auto::runplugin {fn {_plugin ""} args} {
 			}
 			if {[catch {uplevel 1 {*}$call} msg]} {
 				log "$rfn: $msg" 0
+				lassign [info stacktrace] p f l
+				log "    $f:$l @ $p" 0
 			}
 			log "<********* $rfn ([elapsed $st] seconds)" 2
 		}