forked from hummypkg/sweeper
add regsub
This commit is contained in:
parent
e38e90f710
commit
173df12fa7
@ -1,9 +1,9 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.8-3
|
||||
Version: 2.0.8-4
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.2.2-6)
|
||||
Depends: webif(>=1.2.3-2)
|
||||
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/
|
||||
|
@ -35,12 +35,21 @@ proc ::sweeper::strcontains {ref val} {
|
||||
|
||||
set ::sweeper::expand_fns {
|
||||
replace {2}
|
||||
regsub {2}
|
||||
}
|
||||
|
||||
proc ::sweeper::expand_replace {ts &ret search replace} {
|
||||
set ret [string map [list $search $replace] $ret]
|
||||
}
|
||||
|
||||
proc ::sweeper::expand_regsub {ts &ret search replace} {
|
||||
if {[catch {
|
||||
regsub -all -- $search $ret $replace ret
|
||||
} msg]} {
|
||||
log "Error. %regsub - $msg"
|
||||
}
|
||||
}
|
||||
|
||||
# Expand a string containing tokens
|
||||
proc ::sweeper::expand {ts str {orig ""}} {
|
||||
if {[string first "%" $str] == -1} {
|
||||
|
@ -311,7 +311,7 @@ var macros = {
|
||||
desc: 'Remove New: prefix',
|
||||
rules: [
|
||||
{
|
||||
"raw": "title New:* action {settitle {%orig%replace,New: ,,}}",
|
||||
"raw": "title New:* action {settitle {%orig%regsub,New:\\s*,,}}",
|
||||
"name": "Remove New: prefix.",
|
||||
"type": "file",
|
||||
"enabled": "1",
|
||||
@ -324,11 +324,11 @@ var macros = {
|
||||
],
|
||||
"action": {
|
||||
"cmd": "settitle",
|
||||
"arg": "%orig%replace,New: ,,"
|
||||
"arg": "%orig%regsub,New:\\s*,,"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "title New:* action {settitle {%orig%replace,New: ,,}}",
|
||||
"raw": "title New:* action {settitle {%orig%regsub,New:\\s*,,}}",
|
||||
"name": "Unnamed rule",
|
||||
"type": "folder",
|
||||
"enabled": "1",
|
||||
@ -341,7 +341,7 @@ var macros = {
|
||||
],
|
||||
"action": {
|
||||
"cmd": "settitle",
|
||||
"arg": "%orig%replace,New: ,,"
|
||||
"arg": "%orig%regsub,New:\\s*,,"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user