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