more tokens

This commit is contained in:
hummypkg 2014-06-25 20:17:13 +00:00
parent c9ee56cf78
commit cab33c58b2
4 changed files with 63 additions and 7 deletions

View File

@ -1,9 +1,9 @@
Package: sweeper
Priority: optional
Section: misc
Version: 2.0.3
Version: 2.0.5
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif(>=1.0.15-3)
Depends: webif(>=1.0.15-5)
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/

View File

@ -44,23 +44,54 @@ proc ::sweeper::expand {ts str {orig ""}} {
set genre [lindex $glist($tsg) 0]
}
set timestamp [clock format [$ts get start] -format "%Y%m%d%H%M%S"]
set start [$ts get start]
set timestamp [clock format $start -format "%Y%m%d%H%M%S"]
set yyyymmdd [string range $timestamp 0 7]
set hhmm [string range $timestamp 8 11]
set hh [string range $hhmm 0 1]
set mm [string range $hhmm 2 3]
set end [$ts get end]
set etimestamp [clock format $end -format "%Y%m%d%H%M%S"]
set eyyyymmdd [string range $etimestamp 0 7]
set ehhmm [string range $etimestamp 8 11]
set ehh [string range $ehhmm 0 1]
set emm [string range $ehhmm 2 3]
set map [list \
"%orig" $orig \
"%title" [$ts get title] \
"%genre" $genre \
"%definition" [$ts get definition] \
"%lcn" [$ts get channel_num] \
"%channel" [$ts get channel_name] \
"%duration" [$ts duration] \
\
"%timestamp" $timestamp \
"%yyyymmdd" $yyyymmdd \
"%hhmm" $hhmm \
"%orig" $orig \
"%hh" $hh \
"%mm" $mm \
"%year" [clock format $start -format "%Y"] \
"%month" $(0 + [clock format $start -format "%m"]) \
"%date" $(0 + [clock format $start -format "%d"]) \
"%2digityear" [clock format $start -format "%y"] \
"%2digitmonth" [clock format $start -format "%m"] \
"%2digitdate" [clock format $start -format "%d"] \
"%shortday" [clock format $start -format "%a"] \
"%longday" [clock format $start -format "%A"] \
"%shortmonth" [clock format $start -format "%b"] \
"%longmonth" [clock format $start -format "%B"] \
\
"%etimestamp" $etimestamp \
"%eyyyymmdd" $eyyyymmdd \
"%ehhmm" $ehhmm \
"%ehh" $ehh \
"%emm" $emm \
]
log $map 2
set ret [string map $map $str]
log " Expanded \[$str] -> \[$ret]" 2
return $ret

View File

@ -5,8 +5,9 @@ source /mod/webif/lib/setup
require system.class
set dir [cgi_get dir ""]
set root [system mediaroot]
if {$dir eq ""} { set dir [system mediaroot] }
if {$dir eq ""} { set dir $root }
jscss {schema.js config.jim script.js} style.css
jqplugin confirmAction enadis
@ -21,6 +22,7 @@ puts "
<h3>
<img src=img/icon22.png> Sweeper rules for
<span class=\"dir hidden\">$dir</span>
<span class=\"root hidden\">$root</span>
"
# Breadcrumb path
set stub ""
@ -39,8 +41,9 @@ puts {
<button id=b_add>Add rule</button>
<button id=b_save>Save changes</button>
<button id=b_revert>Discard changes</button>
<button id=b_show>View configuration</button>
<button id=b_test>Test configuration</button>
<button id=b_show>View config</button>
<button id=b_test>Test config</button>
<button id=b_edit>Text editor</button>
<button id=b_raw>Toggle raw display</button>
</div>
<div id=output></div>

View File

@ -562,6 +562,28 @@ $('#b_add').button({icons: {primary: "ui-icon-plus"}})
$('#newrule_comment').focus().val('').val('Unnamed rule').select();
});
$('#b_edit').button({icons: {primary: "ui-icon-script"}});
$('#buttons')
.on('click', '#b_edit', function(e) {
e.preventDefault();
if (changed.last && !confirm(
'There are pending changes that will be lost if you switch to ' +
'the text editor. Continue?'))
return;
var dir = $('span.dir').text();
var root = $('span.root').text();
var edir = encodeURIComponent(dir);
if (dir == root)
cf = '/mod/etc/sweeper.conf';
else
cf = edir + '/.sweeper';
window.location = '/edit/edit.jim' +
'?file=' + cf +
'&backdesc=Return+to+sweeper' +
'&backlink=' + encodeURIComponent('/plugin/sweeper/edit.jim?dir=')
+ edir;
});
$('#b_save').button({icons: {primary: "ui-icon-disk"}});
$('#buttons')
.on('click', '#b_save', function(e) {