diff --git a/CONTROL/control b/CONTROL/control index 964f64e..57d3732 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: webif Priority: optional Section: web -Version: 1.0.1 +Version: 1.0.2 Architecture: mipsel 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: Description: An evolving web interface for the Humax. diff --git a/var/mongoose/cgi-bin/db.jim b/var/mongoose/cgi-bin/db.jim index 8972748..9cfe7ae 100755 --- a/var/mongoose/cgi-bin/db.jim +++ b/var/mongoose/cgi-bin/db.jim @@ -6,6 +6,7 @@ source /mod/webif/lib/setup require altrow set databases [glob /var/lib/humaxtv/*.db] +lappend databases {*}[glob /mod/etc/*.db] lappend databases "/mnt/hd2/dms_cds.db" header diff --git a/var/mongoose/html/browse/index.jim b/var/mongoose/html/browse/index.jim index 5ed35ac..4f90f59 100755 --- a/var/mongoose/html/browse/index.jim +++ b/var/mongoose/html/browse/index.jim @@ -77,13 +77,19 @@ proc directory {file bfile tbfile} { puts "" } +set dircount 0 +set filecount 0 + proc entry {file} {{i 0}} { + global dircount filecount + set bfile [file tail $file] regsub -all " +" $bfile "" tbfile if {[string index $bfile 0] == "\025"} { set bfile [string range $bfile 1 end] } if [file isdirectory "$file"] { + incr dircount directory $file $bfile $tbfile return } @@ -116,6 +122,7 @@ proc entry {file} {{i 0}} { set img Video_Other set omenu oopt } + incr filecount set new 0 if {$type eq "ts"} { @@ -313,7 +320,11 @@ switch $order { foreach file $files { entry "$dir/$file" } -puts "Select all | none" +puts " +Select all | none +   +Directories: $dircount, Files: $filecount +" # Sort icons puts "
" diff --git a/var/mongoose/html/js/jquery.contextMenu.js b/var/mongoose/html/js/jquery.contextMenu.js index 6a160b4..4dccec9 100644 --- a/var/mongoose/html/js/jquery.contextMenu.js +++ b/var/mongoose/html/js/jquery.contextMenu.js @@ -106,7 +106,8 @@ if (jQuery) (function() { $(document).unbind('click').unbind('keypress'); $(".contextMenu").hide(); // 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; }); diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index fb4a69f..068dbb3 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -2,7 +2,7 @@ source /mod/webif/lib/setup require lock system.class ts.class tdelete pretty_size browse.class \ - safe_delete settings.class + safe_delete settings.class plugin set loglevel [[settings] autolog] @@ -41,6 +41,34 @@ proc endclock {size} { 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] log "-------------------------------------------------------" @@ -120,9 +148,11 @@ proc do_expire {ts} { log " In use." return } + runplugin preexpire $ts if {[safe_delete $file]} { log " EXPIRE: $file ($age > $ax_days)" 0 log " Deleted." 0 + runplugin postexpire $ts } } } @@ -162,6 +192,7 @@ proc do_shrink {ts} { } set size [$ts size] dsc $size + runplugin preshrink $ts startclock log " SHRINK: $file" 0 log " Estimate $perc% saving." 0 @@ -201,6 +232,7 @@ proc do_shrink {ts} { } $ts set_shrunk log "Done... [endclock $size]" 0 + runplugin postshrink $ts } proc do_decrypt {ts} { @@ -243,6 +275,7 @@ proc do_decrypt {ts} { # Perform the decryption by requesting the file from the DLNA server. set size [$ts size] dsc $size + runplugin predecrypt $ts set flagfile "$tmp/decrypting.$bfile" exec /mod/bin/busybox/touch $flagfile startclock @@ -309,6 +342,7 @@ proc do_decrypt {ts} { } log "Done... [endclock $size]" 0 file delete $flagfile + runplugin postdecrypt $ts } proc do_mpg {ts} { @@ -335,6 +369,7 @@ proc do_mpg {ts} { log " $file - In use." return } + runplugin prempg $ts dsc [$ts size] log " MPG: $file" 0 @@ -355,6 +390,7 @@ proc do_mpg {ts} { # Move the MPG into the local directory file rename $tmp/mpg.mpg $file.mpg + runplugin postmpg $ts } proc do_mp3 {ts} { @@ -382,6 +418,7 @@ proc do_mp3 {ts} { log " $file - In use." return } + runplugin premp3 $ts dsc [$ts size] log " MP3: $file" 0 @@ -410,6 +447,7 @@ proc do_mp3 {ts} { # Move the MP3 into the local directory file rename $tmp/mp3.mp3 $file.mp3 + runplugin postmp3 $ts } proc entries {dir callback} { @@ -502,7 +540,7 @@ if {[llength $argv] > 0} { set loglevel 2 foreach arg $argv { scan $root $arg } } else { - foreach arg {dedup decrypt shrink mpg mp3 expire} { + foreach arg $modules { set st [clock milliseconds] scan $root $arg log "$arg scan completed in [elapsed $st] seconds." diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index 376dee2..281f7b4 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -76,6 +76,7 @@ ts method lock {} { ts method set_shrunk {} { set cmd [list /mod/bin/hmt +shrunk $file] exec {*}$cmd + lappend flags "Shrunk" return 1 }