From 267c4627a85c6d72bfea993d0f9086578152c75c Mon Sep 17 00:00:00 2001 From: hummypkg Date: Wed, 17 Jul 2013 08:54:34 +0000 Subject: [PATCH] update --- CONTROL/control | 2 +- webif/plugin/sweeper/auto.hook | 28 ++++++++++++++++------------ webif/plugin/sweeper/quickedit.hook | 3 +++ webif/plugin/sweeper/test | 4 ++-- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 webif/plugin/sweeper/quickedit.hook diff --git a/CONTROL/control b/CONTROL/control index 808d509..bd4090d 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: sweeper Priority: optional Section: misc -Version: 1.0.0 +Version: 1.0.2 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif(>=1.0.3-3) diff --git a/webif/plugin/sweeper/auto.hook b/webif/plugin/sweeper/auto.hook index cfcad0f..a781af6 100644 --- a/webif/plugin/sweeper/auto.hook +++ b/webif/plugin/sweeper/auto.hook @@ -74,10 +74,10 @@ proc ::sweeper::genre {ts genre} { ###################################################################### -proc ::sweeper::action {ts cmd} { +proc ::sweeper::action {ts cmds} { global root - set rest [lassign $cmd cmd] + lassign $cmds cmd rest log "ACTION: $cmd\($rest)" 2 @@ -88,10 +88,12 @@ proc ::sweeper::action {ts cmd} { log "Moving [$ts get file] to $rest" 0 foreach f [$ts fileset] { log " ....... $f" - #file rename $f "$root/$rest/[file tail $f]" + file rename $f "$root/$rest/[file tail $f]" } - return 1 + } else { + log " ... No such directory $root/$rest" 2 } + return 1 } } return 0 @@ -115,21 +117,19 @@ proc ::sweeper::runrule {ts rule} { return 0 } -proc ::sweeper::scan {args} { - global root - - if {[catch {set fp [open $::sweeper::cf r]} msg]} { - log "Error opening sweeper config, $msg" 0 +proc ::sweeper::apply {dir cf} { + if {[catch {set fp [open $cf r]} msg]} { + log "Error opening sweeper ruleset ($cf), $msg" 0 return } set rules [split [read $fp] "\n"] $fp close - log "Sweep scan starting" 2 + log "Sweep scan starting for $dir" 2 - foreach e [readdir -nocomplain $root] { - set entry "$root/$e" + foreach e [readdir -nocomplain $dir] { + set entry "$dir/$e" if {[file isdirectory $entry]} continue if {![string match {*.ts} $entry]} continue @@ -156,6 +156,10 @@ proc ::sweeper::scan {args} { } } +proc ::sweeper::scan {args} { + ::sweeper::apply $::root $::sweeper::cf +} + if {[file exists $::sweeper::cf]} { register postdecryptscan ::sweeper::scan } diff --git a/webif/plugin/sweeper/quickedit.hook b/webif/plugin/sweeper/quickedit.hook new file mode 100644 index 0000000..c37a0a1 --- /dev/null +++ b/webif/plugin/sweeper/quickedit.hook @@ -0,0 +1,3 @@ + +quickedit /mod/etc/sweeper.conf + diff --git a/webif/plugin/sweeper/test b/webif/plugin/sweeper/test index f199395..3a14633 100755 --- a/webif/plugin/sweeper/test +++ b/webif/plugin/sweeper/test @@ -26,9 +26,9 @@ proc endclock {size} { proc register {args} {} -source auto.hook - set root [system mediaroot] +source auto.hook + ::sweeper::scan 0