diff --git a/CONTROL/control b/CONTROL/control index 291351d..5606a4d 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: sweeper Priority: optional Section: misc -Version: 2.0.13-1 +Version: 2.0.14 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif(>=1.2.5) diff --git a/webif/plugin/sweeper/auto.hook b/webif/plugin/sweeper/auto.hook index b479d03..9489714 100644 --- a/webif/plugin/sweeper/auto.hook +++ b/webif/plugin/sweeper/auto.hook @@ -38,6 +38,7 @@ set ::sweeper::expand_fns { replace {2} regsub {2} asfilename {1 {inline}} + format {2 {inline}} } proc ::sweeper::expand_replace {ts &ret search replace} { @@ -56,6 +57,14 @@ proc ::sweeper::expand_asfilename {ts &ret arg} { return [system filename $arg] } +proc ::sweeper::expand_format {ts &ret format arg} { + if {[catch {set r [format $format $arg]} msg]} { + log "Error. %format - $msg" + return "!FORMAT-ERROR!" + } + return $r +} + # Expand a string containing tokens proc ::sweeper::expand {ts str {orig ""}} { if {[string first "%" $str] == -1} { @@ -759,6 +768,17 @@ proc ::sweeper::action_delete {ts cmd arg folder} { return 1 } +proc ::sweeper::action_log {ts cmd arg folder} { + if {$folder} { + ::sweeper::folder_apply [$ts dir] \ + ::sweeper::action_log $cmd $arg 0 + return 0 + } + set arg [::sweeper::expand $ts $arg] + log "LOG: '$arg'" 0 + return 0 +} + proc ::sweeper::action_flag {ts cmd arg folder} { log "Flagged [$ts get file] as $arg" 0 if {!$::sweeper::dryrun} { diff --git a/webif/plugin/sweeper/schema.js b/webif/plugin/sweeper/schema.js index 6e89650..156f658 100644 --- a/webif/plugin/sweeper/schema.js +++ b/webif/plugin/sweeper/schema.js @@ -330,7 +330,13 @@ var schema = { argtype: 'none', desc: 'Delete recording', continues: false - } + }, + 'log': { + 'class': 'all', + argtype: 'string', + desc: 'Log...', + continues: true + }, } };