diff --git a/CONTROL/control b/CONTROL/control index af9b8a9..73d9911 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: sweeper Priority: optional Section: misc -Version: 2.0.9 +Version: 2.0.10 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif(>=1.2.3-2) +Depends: webif(>=1.2.4-3) 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 2a9e420..5c8062a 100644 --- a/webif/plugin/sweeper/auto.hook +++ b/webif/plugin/sweeper/auto.hook @@ -83,12 +83,16 @@ proc ::sweeper::expand {ts str {orig ""}} { "%title" [$ts get title] \ "%genre" $genre \ "%definition" [$ts get definition] \ + "%synopsis" [$ts get synopsis] \ "%lcn" [$ts get channel_num] \ "%channel" [$ts get channel_name] \ "%duration" [$ts duration] \ \ %epname [$ts episode_name] \ - %episode [$ts epstr] \ + %series [$ts get seriesnum] \ + %episodes [$ts get episodetot] \ + %episode [$ts get episodenum] \ + %epdescr [$ts epstr] \ \ "%timestamp" $timestamp \ "%yyyymmdd" $yyyymmdd \ @@ -113,13 +117,13 @@ proc ::sweeper::expand {ts str {orig ""}} { "%emm" $emm \ ] - log $map 2 +# log $map 2 set ret [string map $map $str] log " Expanded \[$str] -> \[$ret]" 2 foreach {fn params} $::sweeper::expand_fns { - log " Looking for %$fn" 2 +# log " Looking for %$fn" 2 lassign $params numargs @@ -445,6 +449,28 @@ proc ::sweeper::series {ts flag folder} { return 1 } +proc ::sweeper::textmatch {ts str folder} { + if {![regexp -- {^([^~]+)~~(.*)$} $str x target pattern]} { + log "No pattern in textmatch." 1 + return 0 + } + log "Textmatch ($target) against ($pattern)" 2 + return [::sweeper::strcontains [::sweeper::expand $ts $target] $pattern] +} + +proc ::sweeper::intmatch {ts str folder} { + if {![regexp -- {^([^~]+)~~(.*)$} $str x target pattern]} { + log "No pattern in intmatch." 1 + return 0 + } + if {[llength [split $pattern " "]] != 2} { + log "Invalid pattern in numeric comparison." 0 + return 0 + } + log "Intmatch ($target) against ($pattern)" 2 + return [::sweeper::intcomp [::sweeper::expand $ts $target] $pattern] +} + ######################## # Deprecated conditions diff --git a/webif/plugin/sweeper/browse.hook b/webif/plugin/sweeper/browse.hook index cf63c35..8432f4b 100644 --- a/webif/plugin/sweeper/browse.hook +++ b/webif/plugin/sweeper/browse.hook @@ -5,3 +5,8 @@ lappend plugins(dmenu) {sweeper {desc "Sweeper Rules"}} lappend plugins(dmenu) {nosweep {desc "Toggle no-sweep flag"}} +lappend plugins(buttons) "sweeper { + desc {Sweeper Rules} + link {/plugin/sweeper/edit.jim?dir=[cgi_quote_url $dir]} +}" + diff --git a/webif/plugin/sweeper/edit.jim b/webif/plugin/sweeper/edit.jim index a3a44f6..de52ad6 100755 --- a/webif/plugin/sweeper/edit.jim +++ b/webif/plugin/sweeper/edit.jim @@ -161,6 +161,44 @@ For pattern matching, the following special sequences may appear in the pattern: +