diff --git a/CONTROL/control b/CONTROL/control index b3d140a..ea3d262 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -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/ diff --git a/webif/plugin/sweeper/auto.hook b/webif/plugin/sweeper/auto.hook index cef9a29..77493a1 100644 --- a/webif/plugin/sweeper/auto.hook +++ b/webif/plugin/sweeper/auto.hook @@ -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} { diff --git a/webif/plugin/sweeper/schema.js b/webif/plugin/sweeper/schema.js index 1c3bd64..cf76123 100644 --- a/webif/plugin/sweeper/schema.js +++ b/webif/plugin/sweeper/schema.js @@ -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*,," } } ]