2.1.0 with recurse rules
This commit is contained in:
parent
1bc30bff86
commit
885db239e7
@ -1,9 +1,9 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.17
|
||||
Version: 2.1.0
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.2.5-10)
|
||||
Depends: webif(>=1.3.0-1)
|
||||
Description: Sweeper is a package for managing recordings in a variety of ways using custom rules [See forum for details]
|
||||
Tags: http://hummy.tv/forum/threads/5138/
|
||||
|
@ -985,7 +985,7 @@ proc ::sweeper::apply_folder_rules {dir rules} {
|
||||
}
|
||||
}
|
||||
|
||||
proc ::sweeper::apply_rules {dir rules {depth 0}} {
|
||||
proc ::sweeper::apply_rules {dir rules {depth 0} {seen {}}} {
|
||||
|
||||
log "" 2
|
||||
log "--- SWEEP($depth) STARTING FOR $dir ---" 2
|
||||
@ -996,7 +996,14 @@ proc ::sweeper::apply_rules {dir rules {depth 0}} {
|
||||
return
|
||||
}
|
||||
|
||||
set moredepth 0
|
||||
file stat $dir st
|
||||
set key "$st(dev):$st(ino)"
|
||||
if {$key in $seen} {
|
||||
log "Already seen $dir ($key)" 2
|
||||
return
|
||||
}
|
||||
lappend seen $key
|
||||
|
||||
set dirs {}
|
||||
foreach e [readdir -nocomplain $dir] {
|
||||
set entry "$dir/$e"
|
||||
@ -1031,16 +1038,28 @@ proc ::sweeper::apply_rules {dir rules {depth 0}} {
|
||||
if {[llength $rule] < 3} continue
|
||||
set rule [lassign $rule level]
|
||||
if {$level < $depth} continue
|
||||
if {$level > $depth} { incr moredepth }
|
||||
if {[::sweeper::runrule $ts $rule 0]} break
|
||||
}
|
||||
}
|
||||
|
||||
set moredepth 0
|
||||
foreach rule $rules {
|
||||
set level [lindex $rule 0]
|
||||
if {$level > $depth} {
|
||||
incr moredepth
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# No rules require greater recursion
|
||||
if {!$moredepth} return
|
||||
|
||||
foreach dir $dirs {
|
||||
::sweeper::apply_rules $dir $rules $($depth + 1)
|
||||
::sweeper::apply_rules $dir $rules $($depth + 1) $seen
|
||||
|
||||
file stat $dir st
|
||||
set key "$st(dev):$st(ino)"
|
||||
lappend seen $key
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ Add pre-defined ruleset:
|
||||
</span>
|
||||
<span class=comment>Unnamed rule</span>
|
||||
<a class=editcomment href=#>
|
||||
<img src=/img/context/edit.png>
|
||||
<img src=img/edit.png>
|
||||
</a>
|
||||
</span>
|
||||
<span class=legendright>
|
||||
@ -78,19 +78,19 @@ Add pre-defined ruleset:
|
||||
title="Enable/Disable Rule">
|
||||
</a>
|
||||
<a class=delrule href=#>
|
||||
<img src=/img/context/delete.png
|
||||
<img src=img/delete.png
|
||||
title="Delete Rule">
|
||||
</a>
|
||||
<a class=cprule href=#>
|
||||
<img src=/img/context/page_white_copy.png
|
||||
<img src=img/page_white_copy.png
|
||||
title="Duplicate Rule">
|
||||
</a>
|
||||
<a class=uprule href=#>
|
||||
<img src=/img/nav/up.png
|
||||
<img src=img/up.png
|
||||
title="Move Rule Up">
|
||||
</a>
|
||||
<a class=downrule href=#>
|
||||
<img src=/img/nav/down.png
|
||||
<img src=img/down.png
|
||||
title="Move Rule Down">
|
||||
</a>
|
||||
</span>
|
||||
@ -100,7 +100,7 @@ Add pre-defined ruleset:
|
||||
</div>
|
||||
<div class="recursecomment hidden">
|
||||
For each recording and recordings within folders
|
||||
(<span class=depth></span> deep<a class=editdepth href=#><img src=/img/context/edit.png></a>):
|
||||
(<span class=depth></span> deep<a class=editdepth href=#><img src=img/edit.png></a>):
|
||||
</div>
|
||||
<a href=# class=addcriterion>
|
||||
<img src=img/plus.png
|
||||
|
@ -25,16 +25,28 @@ proc endclock {size} {
|
||||
|
||||
proc register {args} {}
|
||||
|
||||
proc scan_run {dir flag callback} {
|
||||
proc scan_run {dir flag callback {seen {}}} {
|
||||
global dustbin
|
||||
|
||||
if {[string match {\[*} [string trimleft [file tail $dir]]]} return
|
||||
|
||||
file stat $dir st
|
||||
set key "$st(dev):$st(ino)"
|
||||
if {$key in $seen} {
|
||||
log "Already seen $dir ($key)" 2
|
||||
return
|
||||
}
|
||||
lappend seen $key
|
||||
|
||||
if {[file exists "$dir/.$flag"]} { $callback $dir }
|
||||
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {[file isdirectory "$dir/$entry"]} {
|
||||
scan_run "$dir/$entry" $flag $callback
|
||||
scan_run "$dir/$entry" $flag $callback $seen
|
||||
|
||||
file stat "$dir/$entry" st
|
||||
set key "$st(dev):$st(ino)"
|
||||
lappend seen $key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
webif/plugin/sweeper/img/delete.png
Normal file
BIN
webif/plugin/sweeper/img/delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 431 B |
BIN
webif/plugin/sweeper/img/down.png
Normal file
BIN
webif/plugin/sweeper/img/down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 300 B |
BIN
webif/plugin/sweeper/img/edit.png
Normal file
BIN
webif/plugin/sweeper/img/edit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 814 B |
BIN
webif/plugin/sweeper/img/page_white_copy.png
Normal file
BIN
webif/plugin/sweeper/img/page_white_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 309 B |
BIN
webif/plugin/sweeper/img/up.png
Normal file
BIN
webif/plugin/sweeper/img/up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 300 B |
@ -19,7 +19,7 @@ foreach {test expected} {
|
||||
{/mod/video/%asfilename:bob/fred:.ts} {/mod/video/bob_fred.ts}
|
||||
{/mod/video/%asfilename:bob/fred:.ts%replace:video:radiator:} {/mod/radiator/bob_fred.ts}
|
||||
{%epname} {6/10. The Fame Game}
|
||||
{%epdescr} {s?e6/10}
|
||||
{%epdescr} {s?e06/10}
|
||||
{%synopsis%regsub,Game:\s*,,} {6/10. The Fame Crime drama. While Sasha is occupied with an intensive training course, the boys' investigations take them to a lookalike agency. [HD] [AD,S]}
|
||||
{Z Nation_ 20150825_2200.ts%regsub,_ \s*, - ,} {Z Nation - 20150825_2200.ts}
|
||||
{%synopsis%regsub:^\s*([^ ]+)\s+([^ ]+).*:\1,\2:} {6/10.,The}
|
||||
@ -30,7 +30,7 @@ foreach {test expected} {
|
||||
puts [format "%-70s => OK" $test]
|
||||
} else {
|
||||
puts [format "%-70s => FAIL" $test]
|
||||
puts " $ret"
|
||||
puts " ($ret)/($expected)"
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user