bug fixes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1979 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
3c44ec33f9
commit
ed042ee230
@ -248,7 +248,7 @@ puts "
|
||||
<table>
|
||||
"
|
||||
setting_toggle "HTTPS web server?" "https" \
|
||||
[file exists /mod/etc/mongoose.cert] 0 1
|
||||
[file exists /mod/etc/webif.pem] 0 1
|
||||
puts "
|
||||
</table>
|
||||
</legend></fieldset>
|
||||
|
@ -29,6 +29,7 @@ if {[lindex $argv 0] eq "-d"} {
|
||||
} else {
|
||||
set logfd [open "/mod/tmp/auto.log" "a+"]
|
||||
}
|
||||
|
||||
proc log {msg {level 1}} {
|
||||
if {$level > $::loglevel} return
|
||||
puts $::logfd "[\
|
||||
@ -58,10 +59,10 @@ foreach mod $modules {
|
||||
set "hook_post${mod}scan" {}
|
||||
}
|
||||
|
||||
proc register {type fn} {
|
||||
proc register {type fn {priority 50}} {
|
||||
global "hook_$type"
|
||||
if {[info exists "hook_$type"]} {
|
||||
lappend "hook_$type" $fn
|
||||
lappend "hook_$type" [list $fn $priority]
|
||||
log "Registered $fn for $type hook." 1
|
||||
} else {
|
||||
log "Unknown hook hook_$type" 0
|
||||
@ -71,8 +72,10 @@ proc register {type fn} {
|
||||
proc runplugin {name {ts 0}} {
|
||||
set var "hook_$name"
|
||||
global $var
|
||||
foreach p [subst $$var] {
|
||||
if {[catch {$p $ts} msg]} {
|
||||
foreach p [lsort -index end -integer [subst $$var]] {
|
||||
lassign $p fn priority
|
||||
log "Running $name plugin $fn (priority $priority)" 2
|
||||
if {[catch {$fn $ts} msg]} {
|
||||
log "Plugin error: $msg" 0
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1 @@
|
||||
|
||||
#proc {dict merge} {dict args} {
|
||||
# foreach d $args {
|
||||
# foreach k [dict keys $d] {
|
||||
# dict set dict $k [dict get $d $k]
|
||||
# }
|
||||
# }
|
||||
# return $dict
|
||||
#}
|
||||
|
||||
|
@ -131,19 +131,28 @@ proc {pkg loaddiagmeta} {} {
|
||||
}
|
||||
}
|
||||
|
||||
proc {pkg fetchmeta} {} {
|
||||
set f [socket stream hummypkg.org.uk:80]
|
||||
$f puts -nonewline "GET /hdrfoxt2/pkg.meta HTTP/1.1\r\n"
|
||||
$f puts -nonewline "Host: hummypkg.org.uk\r\n"
|
||||
proc {pkg fetchfile} {url} {
|
||||
set f [socket stream hpkg.tv:80]
|
||||
$f puts -nonewline "GET /hdrfoxt2/$url HTTP/1.1\r\n"
|
||||
$f puts -nonewline "Host: hpkg.tv\r\n"
|
||||
$f puts -nonewline "Connection: close\r\n"
|
||||
$f puts -nonewline "\r\n"
|
||||
|
||||
# Skip headers in the response.
|
||||
set line [string trim [$f gets]]
|
||||
while {[string length $line]} {
|
||||
#puts "Web Header: $line"
|
||||
set line [string trim [$f gets]]
|
||||
}
|
||||
set ::pkgmeta [$f read]
|
||||
|
||||
# Save the body
|
||||
set ret [$f read]
|
||||
$f close
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc {pkg fetchmeta} {} {
|
||||
set ::pkgmeta [pkg fetchfile pkg.meta]
|
||||
|
||||
set ff [open "/mod/var/pkg.meta" w]
|
||||
puts $ff $::pkgmeta
|
||||
@ -151,18 +160,7 @@ proc {pkg fetchmeta} {} {
|
||||
}
|
||||
|
||||
proc {pkg fetchdiagmeta} {} {
|
||||
set f [socket stream hummypkg.org.uk:80]
|
||||
$f puts -nonewline "GET /diag/diag.meta HTTP/1.1\r\n"
|
||||
$f puts -nonewline "Host: hummypkg.org.uk\r\n"
|
||||
$f puts -nonewline "Connection: close\r\n"
|
||||
$f puts -nonewline "\r\n"
|
||||
|
||||
set line [string trim [$f gets]]
|
||||
while {[string length $line]} {
|
||||
set line [string trim [$f gets]]
|
||||
}
|
||||
set ::diagmeta [$f read]
|
||||
$f close
|
||||
set ::diagmeta [pkg fetchfile diag.meta]
|
||||
|
||||
set ff [open "/mod/var/diag.meta" w]
|
||||
puts $ff $::diagmeta
|
||||
|
@ -96,7 +96,7 @@ if {![exists -proc require]} {
|
||||
foreach c $css { _css $c }
|
||||
}
|
||||
|
||||
require fileops overrides
|
||||
require fileops overrides utils
|
||||
|
||||
# Jim 0.75 removes legacy 'case'
|
||||
alias case switch
|
||||
|
@ -119,10 +119,10 @@ proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
|
||||
}
|
||||
|
||||
if {$status ne ""} {
|
||||
lappend $cache $pkg
|
||||
lappend cache $pkg
|
||||
return 1
|
||||
}
|
||||
lappend $ncache $pkg
|
||||
lappend ncache $pkg
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,10 @@ ts method bfile {} {
|
||||
return [file tail [file rootname $file]]
|
||||
}
|
||||
|
||||
ts method dir {} {
|
||||
return [file dirname $file]
|
||||
}
|
||||
|
||||
ts method duration {{raw 0}} {
|
||||
set d [expr $end - $start]
|
||||
if {!$raw} { set d $($d / 60) }
|
||||
@ -78,49 +82,56 @@ ts method flag {f} {
|
||||
ts method unlock {} {
|
||||
set cmd [list /mod/bin/hmt -lock $file]
|
||||
exec {*}$cmd
|
||||
lremove flags "Locked"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method lock {} {
|
||||
set cmd [list /mod/bin/hmt +lock $file]
|
||||
exec {*}$cmd
|
||||
ladd flags "Locked"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method set_shrunk {} {
|
||||
set cmd [list /mod/bin/hmt +shrunk $file]
|
||||
exec {*}$cmd
|
||||
lappend flags "Shrunk"
|
||||
ladd flags "Shrunk"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method set_deduped {} {
|
||||
set cmd [list /mod/bin/hmt +dedup $file]
|
||||
exec {*}$cmd
|
||||
ladd flags "Deduped"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method unenc {} {
|
||||
set cmd [list /mod/bin/hmt -protect $file]
|
||||
exec {*}$cmd
|
||||
lremove flags "Encrypted"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method enc {} {
|
||||
set cmd [list /mod/bin/hmt +protect $file]
|
||||
exec {*}$cmd
|
||||
ladd flags "Encrypted"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method set_new {} {
|
||||
set cmd [list /mod/bin/hmt +new $file]
|
||||
exec {*}$cmd
|
||||
ladd flags "New"
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method set_watched {} {
|
||||
set cmd [list /mod/bin/hmt -new $file]
|
||||
exec {*}$cmd
|
||||
lremove flags "New"
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -205,12 +216,14 @@ ts method settitle {newtitle} {
|
||||
if {[string length newtitle] > 48} { return }
|
||||
|
||||
exec /mod/bin/hmt "+settitle=${newtitle}" $file
|
||||
set title $newtitle
|
||||
}
|
||||
|
||||
ts method setsynopsis {newsynopsis} {
|
||||
if {[string length newsynopsis] > 252} { return }
|
||||
|
||||
exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file
|
||||
set synopsis $newsynopsis
|
||||
}
|
||||
|
||||
ts method setguidance {newguidance} {
|
||||
@ -221,10 +234,12 @@ ts method setguidance {newguidance} {
|
||||
} else {
|
||||
exec /mod/bin/hmt "+setguidance=${newguidance}" $file
|
||||
}
|
||||
set guidance $newguidance
|
||||
}
|
||||
|
||||
ts method setgenre {newgenre} {
|
||||
exec /mod/bin/hmt "+setgenre=-${newgenre}" $file
|
||||
set genre $newgenre
|
||||
}
|
||||
|
||||
ts method dlnaloc {{urlbase 0}} {
|
||||
|
12
webif/lib/utils
Normal file
12
webif/lib/utils
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
proc ladd {var val} {
|
||||
upvar $var v
|
||||
if {$val ni $v} { lappend v $val }
|
||||
}
|
||||
|
||||
proc lremove {var val} {
|
||||
upvar $var v
|
||||
if {$val ni $v} return
|
||||
set v [lsearch -all -inline -not -exact $v $val]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user