This commit is contained in:
hummypkg 2013-07-17 08:54:34 +00:00
parent 2354e300c1
commit 267c4627a8
4 changed files with 22 additions and 15 deletions

View File

@ -1,7 +1,7 @@
Package: sweeper Package: sweeper
Priority: optional Priority: optional
Section: misc Section: misc
Version: 1.0.0 Version: 1.0.2
Architecture: mipsel Architecture: mipsel
Maintainer: af123@hummypkg.org.uk Maintainer: af123@hummypkg.org.uk
Depends: webif(>=1.0.3-3) Depends: webif(>=1.0.3-3)

View File

@ -74,10 +74,10 @@ proc ::sweeper::genre {ts genre} {
###################################################################### ######################################################################
proc ::sweeper::action {ts cmd} { proc ::sweeper::action {ts cmds} {
global root global root
set rest [lassign $cmd cmd] lassign $cmds cmd rest
log "ACTION: $cmd\($rest)" 2 log "ACTION: $cmd\($rest)" 2
@ -88,10 +88,12 @@ proc ::sweeper::action {ts cmd} {
log "Moving [$ts get file] to $rest" 0 log "Moving [$ts get file] to $rest" 0
foreach f [$ts fileset] { foreach f [$ts fileset] {
log " ....... $f" 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 return 0
@ -115,21 +117,19 @@ proc ::sweeper::runrule {ts rule} {
return 0 return 0
} }
proc ::sweeper::scan {args} { proc ::sweeper::apply {dir cf} {
global root if {[catch {set fp [open $cf r]} msg]} {
log "Error opening sweeper ruleset ($cf), $msg" 0
if {[catch {set fp [open $::sweeper::cf r]} msg]} {
log "Error opening sweeper config, $msg" 0
return return
} }
set rules [split [read $fp] "\n"] set rules [split [read $fp] "\n"]
$fp close $fp close
log "Sweep scan starting" 2 log "Sweep scan starting for $dir" 2
foreach e [readdir -nocomplain $root] { foreach e [readdir -nocomplain $dir] {
set entry "$root/$e" set entry "$dir/$e"
if {[file isdirectory $entry]} continue if {[file isdirectory $entry]} continue
if {![string match {*.ts} $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]} { if {[file exists $::sweeper::cf]} {
register postdecryptscan ::sweeper::scan register postdecryptscan ::sweeper::scan
} }

View File

@ -0,0 +1,3 @@
quickedit /mod/etc/sweeper.conf

View File

@ -26,9 +26,9 @@ proc endclock {size} {
proc register {args} {} proc register {args} {}
source auto.hook
set root [system mediaroot] set root [system mediaroot]
source auto.hook
::sweeper::scan 0 ::sweeper::scan 0