forked from hummypkg/webif
Update to 1.5.0-1
Merge branch 'master' of https://git.hpkg.tv/hummypkg/webif
This commit is contained in:
commit
fd05094d96
|
@ -1,10 +1,10 @@
|
||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 1.4.9-7
|
Version: 1.5.0-1
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hpkg.tv
|
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:
|
Suggests:
|
||||||
Description: An evolving web interface for the Humax.
|
Description: An evolving web interface for the Humax.
|
||||||
Tags: https://hummy.tv/forum/threads/7712/
|
Tags: https://hummy.tv/forum/threads/10581/
|
||||||
|
|
|
@ -82,6 +82,7 @@ switch $action {
|
||||||
set path [$item get path]
|
set path [$item get path]
|
||||||
set file [file tail $path]
|
set file [file tail $path]
|
||||||
set mode [$item get action]
|
set mode [$item get action]
|
||||||
|
set fileonly 0
|
||||||
|
|
||||||
puts "Pasting $file"
|
puts "Pasting $file"
|
||||||
|
|
||||||
|
@ -105,8 +106,13 @@ switch $action {
|
||||||
"$dir/[file tail $f]"}
|
"$dir/[file tail $f]"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
set fileonly 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
set fileonly 1
|
||||||
|
}
|
||||||
|
if {$fileonly} {
|
||||||
if {$mode eq "cut"} {
|
if {$mode eq "cut"} {
|
||||||
catch {file rename $path \
|
catch {file rename $path \
|
||||||
"$dir/[file tail $path]"}
|
"$dir/[file tail $path]"}
|
||||||
|
|
|
@ -7,7 +7,6 @@ require ts.class
|
||||||
httpheader
|
httpheader
|
||||||
|
|
||||||
set file [cgi_get file]
|
set file [cgi_get file]
|
||||||
set ts [ts fetch $file]
|
|
||||||
if {[set ts [ts fetch $file]] != 0} {
|
if {[set ts [ts fetch $file]] != 0} {
|
||||||
set action enc
|
set action enc
|
||||||
if {[$ts flag "Encrypted"]} { set action unenc }
|
if {[$ts flag "Encrypted"]} { set action unenc }
|
||||||
|
|
|
@ -9,6 +9,7 @@ httpheader "application/json"
|
||||||
set file [cgi_get file]
|
set file [cgi_get file]
|
||||||
if {$file == 0} exit
|
if {$file == 0} exit
|
||||||
set ts [ts fetch $file]
|
set ts [ts fetch $file]
|
||||||
|
if {$ts == 0} exit
|
||||||
|
|
||||||
puts "{"
|
puts "{"
|
||||||
puts "\"title\" : \"[jescape [$ts get title]]\","
|
puts "\"title\" : \"[jescape [$ts get title]]\","
|
||||||
|
|
|
@ -7,7 +7,6 @@ require ts.class
|
||||||
httpheader
|
httpheader
|
||||||
|
|
||||||
set file [cgi_get file ""]
|
set file [cgi_get file ""]
|
||||||
set ts [ts fetch $file]
|
|
||||||
if {[set ts [ts fetch $file]] != 0} {
|
if {[set ts [ts fetch $file]] != 0} {
|
||||||
set action lock
|
set action lock
|
||||||
if {[$ts flag "Locked"]} { set action unlock }
|
if {[$ts flag "Locked"]} { set action unlock }
|
||||||
|
|
|
@ -7,7 +7,6 @@ require ts.class
|
||||||
httpheader
|
httpheader
|
||||||
|
|
||||||
set file [cgi_get file]
|
set file [cgi_get file]
|
||||||
set ts [ts fetch $file]
|
|
||||||
if {[set ts [ts fetch $file]] != 0} {
|
if {[set ts [ts fetch $file]] != 0} {
|
||||||
set action new
|
set action new
|
||||||
if {[$ts flag "New"]} { set action watched }
|
if {[$ts flag "New"]} { set action watched }
|
||||||
|
|
|
@ -26,9 +26,7 @@ if {[file isdirectory $file]} {
|
||||||
set new [string map {"\n" ""} [
|
set new [string map {"\n" ""} [
|
||||||
string trim [cgi_get "rename_$attr"]]]
|
string trim [cgi_get "rename_$attr"]]]
|
||||||
set old [$ts get $attr]
|
set old [$ts get $attr]
|
||||||
if {$attr eq "title" || $attr eq "synopsis"} {
|
if {$attr eq "genre"} {
|
||||||
set new "\025$new"
|
|
||||||
} elseif {$attr eq "genre"} {
|
|
||||||
set new [ts genre $new]
|
set new [ts genre $new]
|
||||||
}
|
}
|
||||||
if {$new ne $old} {
|
if {$new ne $old} {
|
||||||
|
|
|
@ -30,7 +30,10 @@ puts "
|
||||||
<table>
|
<table>
|
||||||
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
|
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
|
||||||
"
|
"
|
||||||
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 "*Not in smartctl database*" $line]} continue
|
||||||
if {[string match "*: *" $line]} {
|
if {[string match "*: *" $line]} {
|
||||||
regsub -all -- {[[:space:]]+} $line " " 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"}
|
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
|
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
|
||||||
regsub -all -- {^[[:space:]]+} $line "" line
|
regsub -all -- {^[[:space:]]+} $line "" line
|
||||||
if {[incr i] < 8} continue
|
if {[incr i] < 8} continue
|
||||||
|
@ -185,8 +191,8 @@ puts {
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
||||||
if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} {
|
if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} {
|
||||||
set msg $xmsg
|
set msg ""
|
||||||
}
|
}
|
||||||
|
|
||||||
set i 0
|
set i 0
|
||||||
|
|
|
@ -7,10 +7,8 @@ httpheader
|
||||||
|
|
||||||
set settings [settings]
|
set settings [settings]
|
||||||
|
|
||||||
foreach attr {realloc pending offline} {
|
foreach attr {realloc pending offline spinretry} {
|
||||||
set val [$settings _nval_setting "SMART_$attr"]
|
set val [$settings _nval_setting "SMART_$attr"]
|
||||||
if {$val < 0} continue
|
if {$val < 0} continue
|
||||||
$settings _nval_setting "SMART_ack_$attr" $val
|
$settings _nval_setting "SMART_ack_$attr" $val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,30 @@ source /mod/webif/lib/setup
|
||||||
require system.class
|
require system.class
|
||||||
require settings.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} {} {
|
proc {system disksmart} {} {
|
||||||
set smartmsg ""
|
set smartmsg ""
|
||||||
|
|
||||||
set smartattrs {realloc pending offline spinretry}
|
set smartattrs {realloc pending offline spinretry}
|
||||||
|
|
||||||
set smartattribs(SMART_status) "Unknown"
|
set smartattribs(SMART_status) "Unknown"
|
||||||
foreach sa $smartattrs {
|
foreach sa $smartattrs {
|
||||||
set smartattribs(SMART_$sa) 0
|
set smartattribs(SMART_$sa) 0
|
||||||
set smartattribs(SMART_ack_$sa) 0
|
set smartattribs(SMART_ack_$sa) 0
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach line [[settings] smartdata] {
|
foreach line [[settings] smartdata] {
|
||||||
lassign $line x name x n x t
|
lassign $line x name x n x t
|
||||||
if {$name eq "SMART_status"} {
|
if {$name eq "SMART_status"} {
|
||||||
|
@ -23,22 +36,27 @@ proc {system disksmart} {} {
|
||||||
set smartattribs($name) $n
|
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)
|
# (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 \
|
append smartmsg \
|
||||||
"Disk overall health assessment is: $smartattribs(SMART_status)\n"
|
"Disk overall health assessment is: $smartattribs(SMART_status)\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach sa $smartattrs {
|
foreach sa $smartattrs {
|
||||||
if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} {
|
set count $smartattribs(SMART_$sa)
|
||||||
append smartmsg \
|
set ack_count $smartattribs(SMART_ack_$sa)
|
||||||
"Disk $sa sector count is: $smartattribs(SMART_$sa)"
|
if {$count > $ack_count} {
|
||||||
if {$smartattribs(SMART_ack_$sa) > 0} {
|
append smartmsg [system disksmarterror $sa $count $ack_count]
|
||||||
append smartmsg " (was $smartattribs(SMART_ack_$sa))"
|
} 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
|
return $smartmsg
|
||||||
|
|
|
@ -371,18 +371,22 @@ proc ::auto::runplugin {fn {_plugin ""} args} {
|
||||||
if {[exists -proc $rfn] || [exists -alias $rfn]} {
|
if {[exists -proc $rfn] || [exists -alias $rfn]} {
|
||||||
set st [clock milliseconds]
|
set st [clock milliseconds]
|
||||||
log [string repeat * 56] 2
|
log [string repeat * 56] 2
|
||||||
log "*********> $rfn (Priority $priority)" 2
|
log "*********> $rfn (Priority $priority)" 1
|
||||||
if {$plugin in $legacy && $fn ne "rundir"} {
|
if {$plugin in $legacy && $fn ne "rundir"} {
|
||||||
set call [list $rfn __dummy]
|
set call [list $rfn __dummy]
|
||||||
} else {
|
} else {
|
||||||
set call [list $rfn $args]
|
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
|
log "$rfn: $msg" 0
|
||||||
lassign [info stacktrace] p f l
|
lassign [info stacktrace] p f l
|
||||||
log " $f:$l @ $p" 0
|
log " $f:$l @ $p" 0
|
||||||
}
|
}
|
||||||
log "<********* $rfn ([elapsed $st] seconds)" 2
|
log "<********* $rfn ([elapsed $st] seconds)" 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
source /mod/webif/lib/setup
|
source /mod/webif/lib/setup
|
||||||
require system.class settings.class
|
require system.class settings.class
|
||||||
|
|
||||||
if {[system model] eq "HD"} exit
|
|
||||||
|
|
||||||
set disk [system disk]
|
set disk [system disk]
|
||||||
set settings [settings]
|
set settings [settings]
|
||||||
|
|
||||||
|
@ -20,7 +18,10 @@ if {$line ne ""} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract disk model.
|
# 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 "*Not in smartctl database*" $line]} continue
|
||||||
if {[string match "*: *" $line]} {
|
if {[string match "*: *" $line]} {
|
||||||
regsub -all -- {[[:space:]]+} $line " " line
|
regsub -all -- {[[:space:]]+} $line " " line
|
||||||
|
@ -31,7 +32,11 @@ foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract disk attributes.
|
# 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
|
||||||
regsub -all -- {^[[:space:]]+} $line "" line
|
regsub -all -- {^[[:space:]]+} $line "" line
|
||||||
lassign [split $line] id name flags val worst thresh when rval
|
lassign [split $line] id name flags val worst thresh when rval
|
||||||
|
|
|
@ -2,20 +2,6 @@
|
||||||
if {![exists -command class]} { package require oo }
|
if {![exists -command class]} { package require oo }
|
||||||
if {![exists -command sqlite3.open]} { package require sqlite3 }
|
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 {
|
class settings {
|
||||||
hostname ""
|
hostname ""
|
||||||
channel_group 0
|
channel_group 0
|
||||||
|
@ -55,6 +41,18 @@ class settings {
|
||||||
noautoremove 0
|
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 } {
|
proc {settings _safer_query} { queryText args } {
|
||||||
global settingsdb
|
global settingsdb
|
||||||
|
|
||||||
|
@ -456,3 +454,19 @@ settings method dedup_template {{pattern -1}} {
|
||||||
return $val
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue