git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1545 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-04-17 18:05:12 +00:00
parent 0bca853384
commit 102ae13acb
6 changed files with 58 additions and 6 deletions

View File

@ -1,9 +1,9 @@
Package: webif Package: webif
Priority: optional Priority: optional
Section: web Section: web
Version: 1.0.1 Version: 1.0.2
Architecture: mipsel Architecture: mipsel
Maintainer: af123@hummypkg.org.uk Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.5),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05),ffmpeg,id3v2 Depends: webif-channelicons(>=1.0.5),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.1),smartmontools,tmenu(>=1.05),ffmpeg,id3v2
Suggests: Suggests:
Description: An evolving web interface for the Humax. Description: An evolving web interface for the Humax.

View File

@ -6,6 +6,7 @@ source /mod/webif/lib/setup
require altrow require altrow
set databases [glob /var/lib/humaxtv/*.db] set databases [glob /var/lib/humaxtv/*.db]
lappend databases {*}[glob /mod/etc/*.db]
lappend databases "/mnt/hd2/dms_cds.db" lappend databases "/mnt/hd2/dms_cds.db"
header header

View File

@ -77,13 +77,19 @@ proc directory {file bfile tbfile} {
puts "</div>" puts "</div>"
} }
set dircount 0
set filecount 0
proc entry {file} {{i 0}} { proc entry {file} {{i 0}} {
global dircount filecount
set bfile [file tail $file] set bfile [file tail $file]
regsub -all " +" $bfile "" tbfile regsub -all " +" $bfile "" tbfile
if {[string index $bfile 0] == "\025"} { if {[string index $bfile 0] == "\025"} {
set bfile [string range $bfile 1 end] set bfile [string range $bfile 1 end]
} }
if [file isdirectory "$file"] { if [file isdirectory "$file"] {
incr dircount
directory $file $bfile $tbfile directory $file $bfile $tbfile
return return
} }
@ -116,6 +122,7 @@ proc entry {file} {{i 0}} {
set img Video_Other set img Video_Other
set omenu oopt set omenu oopt
} }
incr filecount
set new 0 set new 0
if {$type eq "ts"} { if {$type eq "ts"} {
@ -313,7 +320,11 @@ switch $order {
foreach file $files { entry "$dir/$file" } foreach file $files { entry "$dir/$file" }
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>" puts "
<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>
&nbsp;&nbsp;
Directories: $dircount, Files: $filecount
"
# Sort icons # Sort icons
puts "<div id=sortdiv>" puts "<div id=sortdiv>"

View File

@ -106,7 +106,8 @@ if (jQuery) (function() {
$(document).unbind('click').unbind('keypress'); $(document).unbind('click').unbind('keypress');
$(".contextMenu").hide(); $(".contextMenu").hide();
// Callback // Callback
if (callback) callback($(this).attr('href').substr(1), $(srcElement), { x: x - offset.left, y: y - offset.top, docX: x, docY: y }); //if (callback) callback($(this).attr('href').substr(1), $(srcElement), { x: x - offset.left, y: y - offset.top, docX: x, docY: y });
if (callback) callback($(this).attr('href').substr(1), $(srcElement));
return false; return false;
}); });

View File

@ -2,7 +2,7 @@
source /mod/webif/lib/setup source /mod/webif/lib/setup
require lock system.class ts.class tdelete pretty_size browse.class \ require lock system.class ts.class tdelete pretty_size browse.class \
safe_delete settings.class safe_delete settings.class plugin
set loglevel [[settings] autolog] set loglevel [[settings] autolog]
@ -41,6 +41,34 @@ proc endclock {size} {
return "[pretty_size $size] in $el seconds - [pretty_size $rate]/s" return "[pretty_size $size] in $el seconds - [pretty_size $rate]/s"
} }
set modules {dedup decrypt shrink mpg mp3 expire}
foreach mod $modules {
set "hook_pre$mod" {}
set "hook_post$mod" {}
}
proc register {type fn} {
global "hook_$type"
if {[info exists "hook_$type"]} {
lappend "hook_$type" $fn
log "Registered $fn for $type hook." 1
} else {
log "Unknown hook hook_$type" 0
}
}
proc runplugin {name ts} {
set var "hook_$name"
global $var
foreach p [subst $$var] {
if {[catch {$p $ts} msg]} {
log "Plugin error: $msg" 0
}
}
}
eval_plugins auto
set scanstart [clock milliseconds] set scanstart [clock milliseconds]
log "-------------------------------------------------------" log "-------------------------------------------------------"
@ -120,9 +148,11 @@ proc do_expire {ts} {
log " In use." log " In use."
return return
} }
runplugin preexpire $ts
if {[safe_delete $file]} { if {[safe_delete $file]} {
log " EXPIRE: $file ($age > $ax_days)" 0 log " EXPIRE: $file ($age > $ax_days)" 0
log " Deleted." 0 log " Deleted." 0
runplugin postexpire $ts
} }
} }
} }
@ -162,6 +192,7 @@ proc do_shrink {ts} {
} }
set size [$ts size] set size [$ts size]
dsc $size dsc $size
runplugin preshrink $ts
startclock startclock
log " SHRINK: $file" 0 log " SHRINK: $file" 0
log " Estimate $perc% saving." 0 log " Estimate $perc% saving." 0
@ -201,6 +232,7 @@ proc do_shrink {ts} {
} }
$ts set_shrunk $ts set_shrunk
log "Done... [endclock $size]" 0 log "Done... [endclock $size]" 0
runplugin postshrink $ts
} }
proc do_decrypt {ts} { proc do_decrypt {ts} {
@ -243,6 +275,7 @@ proc do_decrypt {ts} {
# Perform the decryption by requesting the file from the DLNA server. # Perform the decryption by requesting the file from the DLNA server.
set size [$ts size] set size [$ts size]
dsc $size dsc $size
runplugin predecrypt $ts
set flagfile "$tmp/decrypting.$bfile" set flagfile "$tmp/decrypting.$bfile"
exec /mod/bin/busybox/touch $flagfile exec /mod/bin/busybox/touch $flagfile
startclock startclock
@ -309,6 +342,7 @@ proc do_decrypt {ts} {
} }
log "Done... [endclock $size]" 0 log "Done... [endclock $size]" 0
file delete $flagfile file delete $flagfile
runplugin postdecrypt $ts
} }
proc do_mpg {ts} { proc do_mpg {ts} {
@ -335,6 +369,7 @@ proc do_mpg {ts} {
log " $file - In use." log " $file - In use."
return return
} }
runplugin prempg $ts
dsc [$ts size] dsc [$ts size]
log " MPG: $file" 0 log " MPG: $file" 0
@ -355,6 +390,7 @@ proc do_mpg {ts} {
# Move the MPG into the local directory # Move the MPG into the local directory
file rename $tmp/mpg.mpg $file.mpg file rename $tmp/mpg.mpg $file.mpg
runplugin postmpg $ts
} }
proc do_mp3 {ts} { proc do_mp3 {ts} {
@ -382,6 +418,7 @@ proc do_mp3 {ts} {
log " $file - In use." log " $file - In use."
return return
} }
runplugin premp3 $ts
dsc [$ts size] dsc [$ts size]
log " MP3: $file" 0 log " MP3: $file" 0
@ -410,6 +447,7 @@ proc do_mp3 {ts} {
# Move the MP3 into the local directory # Move the MP3 into the local directory
file rename $tmp/mp3.mp3 $file.mp3 file rename $tmp/mp3.mp3 $file.mp3
runplugin postmp3 $ts
} }
proc entries {dir callback} { proc entries {dir callback} {
@ -502,7 +540,7 @@ if {[llength $argv] > 0} {
set loglevel 2 set loglevel 2
foreach arg $argv { scan $root $arg } foreach arg $argv { scan $root $arg }
} else { } else {
foreach arg {dedup decrypt shrink mpg mp3 expire} { foreach arg $modules {
set st [clock milliseconds] set st [clock milliseconds]
scan $root $arg scan $root $arg
log "$arg scan completed in [elapsed $st] seconds." log "$arg scan completed in [elapsed $st] seconds."

View File

@ -76,6 +76,7 @@ ts method lock {} {
ts method set_shrunk {} { ts method set_shrunk {} {
set cmd [list /mod/bin/hmt +shrunk $file] set cmd [list /mod/bin/hmt +shrunk $file]
exec {*}$cmd exec {*}$cmd
lappend flags "Shrunk"
return 1 return 1
} }