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
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)

View File

@ -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
}

View File

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

View File

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