From b8833af06858414fb77705bab36abcaa95b8f646 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 22 Jun 2015 20:16:48 +0000 Subject: [PATCH] various bug fixes --- CONTROL/control | 2 +- webif/plugin/sweeper/auto.hook | 44 ++++++++++++++++------------- webif/plugin/sweeper/edit.jim | 10 +++++-- webif/plugin/sweeper/rules_json.jim | 19 +++++++++---- webif/plugin/sweeper/schema.js | 10 +++++++ webif/plugin/sweeper/script.js | 42 +++++++++++++++++++++------ 6 files changed, 91 insertions(+), 36 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index ea3d262..2c7c55b 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: sweeper Priority: optional Section: misc -Version: 2.0.8-4 +Version: 2.0.8-5 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif(>=1.2.3-2) diff --git a/webif/plugin/sweeper/auto.hook b/webif/plugin/sweeper/auto.hook index 77493a1..62b9fcd 100644 --- a/webif/plugin/sweeper/auto.hook +++ b/webif/plugin/sweeper/auto.hook @@ -87,6 +87,9 @@ proc ::sweeper::expand {ts str {orig ""}} { "%channel" [$ts get channel_name] \ "%duration" [$ts duration] \ \ + %epname [$ts episode_name] \ + %episode [$ts epstr] \ + \ "%timestamp" $timestamp \ "%yyyymmdd" $yyyymmdd \ "%hhmm" $hhmm \ @@ -740,16 +743,11 @@ proc ::sweeper::clause {folder cmd arg ts} { ###################################################################### -proc ::sweeper::runrule {ts rule} { +proc ::sweeper::runrule {ts rule folder} { log "Processing \[$rule]" 2 if {[string index $rule 0] eq "#" || [llength $rule] < 2} { return 0 } - set folder 0 - if {[lindex $rule 0] eq "folder"} { - set folder 1 - set rule [lrange $rule 1 end] - } while {[llength $rule] > 1} { set rule [lassign $rule cmd arg] set ret [::sweeper::clause $folder $cmd $arg $ts] @@ -777,7 +775,10 @@ proc ::sweeper::apply {dir cf} { set runfolder 0 set nrules 0 foreach rule $rules { - if {[lindex $rule 0] eq "folder"} { incr runfolder } + switch -- [lindex $rule 0] { + folder - + global { incr runfolder } + } if {[string index $rule 0] ne "#" && [llength $rule] > 1} { incr nrules } @@ -812,10 +813,13 @@ proc ::sweeper::apply {dir cf} { } foreach rule $rules { - if {[lindex $rule 0] eq "folder"} continue if {[string index $rule 0] eq "#" || [llength $rule] < 2} continue - if {[::sweeper::runrule $ts $rule]} break + switch -- [lindex $rule 0] { + folder continue + global { set rule [lrange $rule 1 end] } + } + if {[::sweeper::runrule $ts $rule 0]} break } } @@ -840,14 +844,12 @@ proc ::sweeper::apply {dir cf} { } set ts 0 - foreach de [readdir -nocomplain $entry] { + foreach de [lsort -command [lambda {a b} { + upvar entry e + return $([file mtime "$e/$b"] - [file mtime "$e/$a"]) + }] [lsearch -glob -all -inline \ + [readdir -nocomplain $entry] {*.ts}]] { set dentry "$entry/$de" - if {[file isdirectory $dentry]} { - set ts 0 - break - } - if {$ts ne "0"} continue - if {![string match {*.ts} $dentry]} continue log " --- Considering $dentry" 2 @@ -876,9 +878,13 @@ proc ::sweeper::apply {dir cf} { foreach rule $rules { if {[string index $rule 0] eq "#" || - [llength $rule] < 2} continue - if {[lindex $rule 0] ne "folder"} continue - if {[::sweeper::runrule $ts $rule]} break + [llength $rule] < 3} continue + switch -- [lindex $rule 0] { + folder - + global { set rule [lrange $rule 1 end] } + default continue + } + if {[::sweeper::runrule $ts $rule 1]} break } } diff --git a/webif/plugin/sweeper/edit.jim b/webif/plugin/sweeper/edit.jim index a2d521d..9da0c89 100755 --- a/webif/plugin/sweeper/edit.jim +++ b/webif/plugin/sweeper/edit.jim @@ -61,10 +61,10 @@ Add pre-defined ruleset:
-