diff --git a/CONTROL/control b/CONTROL/control
index ac793af0..334713b9 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
-Version: 1.4.9-7
+Version: 1.5.0-1
Architecture: mipsel
Maintainer: af123@hpkg.tv
-Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-2),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),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.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
+Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.81),jim-pack(>=0.81),jim-oo(>=0.81),jim-sqlite3(>=0.81),jim-cgi(>=0.7-2),jim-binary(>=0.78),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
Suggests:
Description: An evolving web interface for the Humax.
-Tags: https://hummy.tv/forum/threads/7712/
+Tags: https://hummy.tv/forum/threads/10581/
diff --git a/webif/html/browse/clipboard.jim b/webif/html/browse/clipboard.jim
index ed2a1eae..c89317de 100755
--- a/webif/html/browse/clipboard.jim
+++ b/webif/html/browse/clipboard.jim
@@ -82,6 +82,7 @@ switch $action {
set path [$item get path]
set file [file tail $path]
set mode [$item get action]
+ set fileonly 0
puts "Pasting $file"
@@ -105,8 +106,13 @@ switch $action {
"$dir/[file tail $f]"}
}
}
+ } else {
+ set fileonly 1
}
} else {
+ set fileonly 1
+ }
+ if {$fileonly} {
if {$mode eq "cut"} {
catch {file rename $path \
"$dir/[file tail $path]"}
diff --git a/webif/html/browse/enc.jim b/webif/html/browse/enc.jim
index 8869aa5f..11877f60 100755
--- a/webif/html/browse/enc.jim
+++ b/webif/html/browse/enc.jim
@@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file]
-set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action enc
if {[$ts flag "Encrypted"]} { set action unenc }
diff --git a/webif/html/browse/epgtitle.jim b/webif/html/browse/epgtitle.jim
index 7cdfbcdd..fb99306b 100755
--- a/webif/html/browse/epgtitle.jim
+++ b/webif/html/browse/epgtitle.jim
@@ -9,6 +9,7 @@ httpheader "application/json"
set file [cgi_get file]
if {$file == 0} exit
set ts [ts fetch $file]
+if {$ts == 0} exit
puts "{"
puts "\"title\" : \"[jescape [$ts get title]]\","
diff --git a/webif/html/browse/lock.jim b/webif/html/browse/lock.jim
index 021de4bc..37da1f64 100755
--- a/webif/html/browse/lock.jim
+++ b/webif/html/browse/lock.jim
@@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file ""]
-set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action lock
if {[$ts flag "Locked"]} { set action unlock }
diff --git a/webif/html/browse/new.jim b/webif/html/browse/new.jim
index ec0fbf0b..047f5d20 100755
--- a/webif/html/browse/new.jim
+++ b/webif/html/browse/new.jim
@@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file]
-set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action new
if {[$ts flag "New"]} { set action watched }
diff --git a/webif/html/browse/rename.jim b/webif/html/browse/rename.jim
index 6f7f31dc..4f78d105 100755
--- a/webif/html/browse/rename.jim
+++ b/webif/html/browse/rename.jim
@@ -26,9 +26,7 @@ if {[file isdirectory $file]} {
set new [string map {"\n" ""} [
string trim [cgi_get "rename_$attr"]]]
set old [$ts get $attr]
- if {$attr eq "title" || $attr eq "synopsis"} {
- set new "\025$new"
- } elseif {$attr eq "genre"} {
+ if {$attr eq "genre"} {
set new [ts genre $new]
}
if {$new ne $old} {
diff --git a/webif/html/diag/disk.jim b/webif/html/diag/disk.jim
index f6f0dc0e..4dc06589 100755
--- a/webif/html/diag/disk.jim
+++ b/webif/html/diag/disk.jim
@@ -30,7 +30,10 @@ puts "
SMART Status | $smart | |
"
-foreach line [split [exec /bin/smartctl -i $device] "\n"] {
+if {[catch {set msg [exec /bin/smartctl -i $device]} xmsg]} {
+ set msg $xmsg
+}
+foreach line [split $msg "\n"] {
if {[string match "*Not in smartctl database*" $line]} continue
if {[string match "*: *" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
@@ -95,8 +98,11 @@ set nolife {184 187 188 189 191 197 198}
set derive {4 "" 5 sectors 9 hours 12 cycles 192 "" 193 "cycles"}
+if {[catch {set msg [exec /bin/smartctl -A $device]}]} {
+ set msg ""
+}
set i 0
-foreach line [split [exec /bin/smartctl -A $device] "\n"] {
+foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
if {[incr i] < 8} continue
@@ -185,8 +191,8 @@ puts {
}
-if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} {
- set msg $xmsg
+if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} {
+ set msg ""
}
set i 0
diff --git a/webif/html/diag/diskack.jim b/webif/html/diag/diskack.jim
index 331574bc..a9dafd79 100755
--- a/webif/html/diag/diskack.jim
+++ b/webif/html/diag/diskack.jim
@@ -7,10 +7,8 @@ httpheader
set settings [settings]
-foreach attr {realloc pending offline} {
+foreach attr {realloc pending offline spinretry} {
set val [$settings _nval_setting "SMART_$attr"]
if {$val < 0} continue
$settings _nval_setting "SMART_ack_$attr" $val
}
-
-
diff --git a/webif/include/diskcheck.jim b/webif/include/diskcheck.jim
index e79660af..fb6c3f23 100755
--- a/webif/include/diskcheck.jim
+++ b/webif/include/diskcheck.jim
@@ -4,17 +4,30 @@ source /mod/webif/lib/setup
require system.class
require settings.class
+proc {system disksmarterror} {sa count ack_count} {
+ if {$sa eq "spinretry"} {
+ set msg "Disk $sa count is: $count"
+ } else {
+ set msg "Disk $sa sector count is: $count"
+ }
+ if {$ack_count > 0} {
+ append msg " (was $ack_count)"
+ }
+ append msg "\n"
+ return $msg
+}
+
proc {system disksmart} {} {
set smartmsg ""
-
+
set smartattrs {realloc pending offline spinretry}
-
+
set smartattribs(SMART_status) "Unknown"
foreach sa $smartattrs {
set smartattribs(SMART_$sa) 0
set smartattribs(SMART_ack_$sa) 0
}
-
+
foreach line [[settings] smartdata] {
lassign $line x name x n x t
if {$name eq "SMART_status"} {
@@ -23,22 +36,27 @@ proc {system disksmart} {} {
set smartattribs($name) $n
}
}
-
+
# (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7)
-
- if {$smartattribs(SMART_status) ne "PASSED"} {
+
+ if {$smartattribs(SMART_status) ne "PASSED" &&
+ $smartattribs(SMART_status) ne "Unknown" &&
+ $smartattribs(SMART_status) ne ""} {
append smartmsg \
"Disk overall health assessment is: $smartattribs(SMART_status)\n"
}
-
+
foreach sa $smartattrs {
- if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} {
- append smartmsg \
- "Disk $sa sector count is: $smartattribs(SMART_$sa)"
- if {$smartattribs(SMART_ack_$sa) > 0} {
- append smartmsg " (was $smartattribs(SMART_ack_$sa))"
+ set count $smartattribs(SMART_$sa)
+ set ack_count $smartattribs(SMART_ack_$sa)
+ if {$count > $ack_count} {
+ append smartmsg [system disksmarterror $sa $count $ack_count]
+ } elseif {$count < $ack_count} {
+ if {($sa eq "pending" || $sa eq "offline") && ($count > 0)} {
+ append smartmsg [system disksmarterror $sa $count $ack_count]
+ } else {
+ [settings] _nval_setting "SMART_ack_$sa" $count
}
- append smartmsg "\n"
}
}
return $smartmsg
diff --git a/webif/lib/auto/scan b/webif/lib/auto/scan
index 3926ad6e..6915ebc7 100755
--- a/webif/lib/auto/scan
+++ b/webif/lib/auto/scan
@@ -371,18 +371,22 @@ proc ::auto::runplugin {fn {_plugin ""} args} {
if {[exists -proc $rfn] || [exists -alias $rfn]} {
set st [clock milliseconds]
log [string repeat * 56] 2
- log "*********> $rfn (Priority $priority)" 2
+ log "*********> $rfn (Priority $priority)" 1
if {$plugin in $legacy && $fn ne "rundir"} {
set call [list $rfn __dummy]
} else {
set call [list $rfn $args]
}
- if {[catch {uplevel 1 {*}$call} msg]} {
+ set ologprefix $::auto::logprefix
+ set ::auto::logprefix "$plugin:$::auto::logprefix"
+ set ret [catch {uplevel 1 {*}$call} msg]
+ set ::auto::logprefix $ologprefix
+ if {$ret} {
log "$rfn: $msg" 0
lassign [info stacktrace] p f l
log " $f:$l @ $p" 0
}
- log "<********* $rfn ([elapsed $st] seconds)" 2
+ log "<********* $rfn ([elapsed $st] seconds)" 1
}
}
}
diff --git a/webif/lib/bin/diskattrs b/webif/lib/bin/diskattrs
index d03b8b1b..bb912e90 100755
--- a/webif/lib/bin/diskattrs
+++ b/webif/lib/bin/diskattrs
@@ -3,8 +3,6 @@
source /mod/webif/lib/setup
require system.class settings.class
-if {[system model] eq "HD"} exit
-
set disk [system disk]
set settings [settings]
@@ -20,7 +18,10 @@ if {$line ne ""} {
}
# Extract disk model.
-foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
+if {[catch {set msg [exec /bin/smartctl -i $disk]}]} {
+ set msg ""
+}
+foreach line [split $msg "\n"] {
if {[string match "*Not in smartctl database*" $line]} continue
if {[string match "*: *" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
@@ -31,7 +32,11 @@ foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
}
# Extract disk attributes.
-foreach line [split [exec /bin/smartctl -A -f brief $disk] "\n"] {
+if {[catch {set msg [exec /bin/smartctl -A -f brief $disk]}]} {
+ set msg ""
+}
+set attrs {}
+foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
lassign [split $line] id name flags val worst thresh when rval
diff --git a/webif/lib/settings.class b/webif/lib/settings.class
index 59b35ef5..e66029b5 100644
--- a/webif/lib/settings.class
+++ b/webif/lib/settings.class
@@ -2,20 +2,6 @@
if {![exists -command class]} { package require oo }
if {![exists -command sqlite3.open]} { package require sqlite3 }
-if {![file exists /mod/etc/webif.db]} {
- set ::settingsdb [sqlite3.open /mod/etc/webif.db]
- catch {
- $::settingsdb query {
- CREATE TABLE settings(name text, nval int, tval text);
- }
- $::settingsdb query {
- CREATE UNIQUE INDEX key on settings(name);
- }
- }
-} else {
- set ::settingsdb [sqlite3.open /mod/etc/webif.db]
-}
-
class settings {
hostname ""
channel_group 0
@@ -55,6 +41,18 @@ class settings {
noautoremove 0
}
+proc {settings _create} {} {
+ global settingsdb
+ catch {
+ $settingsdb query {
+ CREATE TABLE settings(name text, nval int, tval text);
+ }
+ $settingsdb query {
+ CREATE UNIQUE INDEX key on settings(name);
+ }
+ }
+}
+
proc {settings _safer_query} { queryText args } {
global settingsdb
@@ -456,3 +454,19 @@ settings method dedup_template {{pattern -1}} {
return $val
}
+
+set dbname /mod/etc/webif.db
+if {![file exists $dbname]} {
+ set ::settingsdb [sqlite3.open $dbname]
+ settings _create
+} else {
+ set ::settingsdb [sqlite3.open $dbname]
+ try {
+ # force use of index (SQLite3 extension) for validation
+ $::settingsdb query {
+ select name, nval, tval from settings indexed by key where name = '';
+ }
+ } on error {msg opts} {
+ settings _create
+ }
+}