From 3c4b907091c714f3e2212c8850caa4b221aa8d89 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 7 Jul 2014 22:06:57 +0000 Subject: [PATCH] pass processed file list to plugins git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2016 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/lib/bin/auto | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index ad68364..670ad57 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.0.15-6 +Version: 1.0.15-7 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.12-1),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose diff --git a/webif/lib/bin/auto b/webif/lib/bin/auto index 114cfd9..b652658 100755 --- a/webif/lib/bin/auto +++ b/webif/lib/bin/auto @@ -75,7 +75,7 @@ proc runplugin {name {ts 0}} { foreach p [lsort -index end -decreasing -integer [subst $$var]] { lassign $p fn priority log "Running $name plugin $fn (priority $priority)" 2 - if {[catch {$fn $ts} msg]} { + if {[catch {uplevel 1 $fn $ts} msg]} { log "Plugin error: $msg" 0 } } @@ -159,7 +159,7 @@ proc dedup {dir} { } proc do_shrink {ts} { - global tmp dustbin tsgroup + global tmp dustbin tsgroup processed_files set file [$ts get file] if {[$ts flag "Shrunk"]} { @@ -247,11 +247,12 @@ proc do_shrink {ts} { } $ts set_shrunk log "Done... [endclock $size]" 0 + lappend processed_files [$ts get file] runplugin postshrink $ts } proc do_decrypt {ts} { - global tmp dustbin + global tmp dustbin processed_files set file [$ts get file] set rfile [file rootname $file] @@ -364,11 +365,12 @@ proc do_decrypt {ts} { } log "Done... [endclock $size]" 0 file delete $flagfile + lappend processed_files [$ts get file] runplugin postdecrypt $ts } proc do_mpg {ts} { - global tmp tsgroup + global tmp tsgroup processed_files set file [file rootname [$ts get file]] @@ -412,11 +414,12 @@ proc do_mpg {ts} { # Move the MPG into the local directory file rename $tmp/mpg.mpg $file.mpg + lappend processed_files [$ts get file] runplugin postmpg $ts } proc do_mp3 {ts} { - global tmp tsgroup + global tmp tsgroup processed_files set file [file rootname [$ts get file]] @@ -471,6 +474,7 @@ proc do_mp3 {ts} { # Move the MP3 into the local directory file rename $tmp/mp3.mp3 $file.mp3 + lappend processed_files [$ts get file] runplugin postmp3 $ts } @@ -686,14 +690,23 @@ if {[lindex $argv 0] eq "-single"} { scansingle [lrange $argv 1 end] } elseif {[llength $argv] > 0} { set loglevel 2 - foreach arg $argv { scan $root $arg } + foreach arg $argv { + set st [clock milliseconds] + log "$arg scan starting." + set processed_files {} + runplugin "pre${arg}scan" + scan $root $arg + runplugin "post${arg}scan" processed_files + log "$arg scan completed in [elapsed $st] seconds." + } } else { foreach arg $modules { set st [clock milliseconds] log "$arg scan starting." + set processed_files {} runplugin "pre${arg}scan" scan $root $arg - runplugin "post${arg}scan" + runplugin "post${arg}scan" processed_files log "$arg scan completed in [elapsed $st] seconds." } }