forked from hummypkg/sweeper
update
This commit is contained in:
parent
2354e300c1
commit
267c4627a8
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
3
webif/plugin/sweeper/quickedit.hook
Normal file
3
webif/plugin/sweeper/quickedit.hook
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
quickedit /mod/etc/sweeper.conf
|
||||
|
@ -26,9 +26,9 @@ proc endclock {size} {
|
||||
|
||||
proc register {args} {}
|
||||
|
||||
source auto.hook
|
||||
|
||||
set root [system mediaroot]
|
||||
|
||||
source auto.hook
|
||||
|
||||
::sweeper::scan 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user