series condition, matches in substr
This commit is contained in:
parent
cab33c58b2
commit
92a11f1092
@ -1,7 +1,7 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.5
|
||||
Version: 2.0.6
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.0.15-5)
|
||||
|
@ -9,5 +9,22 @@ if [ ! -f $f ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -f /mod/.swschema ] && schema=`cat /mod/.swschema` || schema=1
|
||||
|
||||
case schema in
|
||||
1)
|
||||
# Upgrade folder rules
|
||||
echo "Upgrading sweeper rules for folder series."
|
||||
(echo /mod/etc/sweeper.conf; find /media -follow -name .sweeper) \
|
||||
| while read f; do
|
||||
[ -f "$f" ] || continue
|
||||
echo "Processing $f..."
|
||||
sed -e 's/^folder /& series "" /' -i "$f"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
echo 2 > /mod/.swschema
|
||||
|
||||
exit 0
|
||||
|
||||
|
@ -23,8 +23,11 @@ proc ::sweeper::intcomp {ref val} {
|
||||
return [expr $ref $op $num]
|
||||
}
|
||||
|
||||
# Substring check
|
||||
# Substring/pattern check
|
||||
proc ::sweeper::strcontains {ref val} {
|
||||
if {[string first "*" $val] > -1} {
|
||||
return [string match -nocase $val $ref]
|
||||
}
|
||||
return [expr \
|
||||
[string first [string tolower $val] [string tolower $ref]] \
|
||||
>= 0]
|
||||
@ -287,7 +290,7 @@ proc ::sweeper::hour {ts str folder} {
|
||||
}
|
||||
|
||||
proc ::sweeper::schedduration {ts dur folder} {
|
||||
return [::sweeper::intcomp [$ts get scheddur] $dur]
|
||||
return [::sweeper::intcomp [expr [$ts get scheddur] / 60] $dur]
|
||||
}
|
||||
|
||||
proc ::sweeper::size {ts size folder} {
|
||||
@ -344,6 +347,27 @@ proc ::sweeper::foldername {ts str folder} {
|
||||
return [::sweeper::strcontains [$ts dir] $str]
|
||||
}
|
||||
|
||||
proc ::sweeper::series {ts flag folder} {
|
||||
if {!$folder} { return 0 }
|
||||
set dir [$ts dir]
|
||||
if {![file exists "$dir/.series"]} {
|
||||
log "Not series folder (nofile)." 2
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check if the .series entry is a real one versus one created
|
||||
# by ts resetnew
|
||||
set fd [open "$dir/.series"]
|
||||
set bytes [read $fd]
|
||||
close $fd
|
||||
set sbytes [unpack $bytes -uintle 160 32]
|
||||
if {$sbytes == 0} {
|
||||
log "Not series folder." 2
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
########################
|
||||
# Deprecated conditions
|
||||
|
||||
@ -741,22 +765,6 @@ proc ::sweeper::apply {dir cf} {
|
||||
continue
|
||||
}
|
||||
|
||||
if {![file exists "$entry/.series"]} {
|
||||
log "Not series folder." 2
|
||||
continue
|
||||
}
|
||||
|
||||
# Check if the .series entry is a real one versus one created
|
||||
# by ts resetnew
|
||||
set fd [open "$entry/.series"]
|
||||
set bytes [read $fd]
|
||||
close $fd
|
||||
set sbytes [unpack $bytes -uintle 160 32]
|
||||
if {$sbytes == 0} {
|
||||
log ".series file was auto-created, skipping folder."
|
||||
continue
|
||||
}
|
||||
|
||||
set ts 0
|
||||
foreach de [readdir -nocomplain $entry] {
|
||||
set dentry "$entry/$de"
|
||||
|
@ -97,6 +97,9 @@ Add pre-defined ruleset:
|
||||
</a>
|
||||
</span>
|
||||
</legend>
|
||||
<div class="foldercomment hidden">
|
||||
For each sub-folder, inspect a recording within and:
|
||||
</div>
|
||||
<a href=# class=addcriterion>
|
||||
<img src=img/plus.png
|
||||
title="Add condition">
|
||||
@ -116,6 +119,22 @@ Add pre-defined ruleset:
|
||||
|
||||
<div class=hidden id=edit_text title="Edit text">
|
||||
<input name=edit_text_field id=edit_text_field size=80 maxlength=255 />
|
||||
<div class="hidden edit_text_help blood" id=edit_text_help_substr>
|
||||
<br>
|
||||
You can enter either a substring which must be found somewhere or a pattern<br>
|
||||
which must be matched.
|
||||
<br>
|
||||
For pattern matching, the following special sequences may appear in the pattern:
|
||||
<div style="width: 600px;margin: 1em">
|
||||
* - Matches any sequence of characters in string, including none.
|
||||
<br>
|
||||
? - Matches any single character in string.
|
||||
<br>
|
||||
[chars] - Matches any character in the set given by chars. If a sequence of the form x-y appears in chars, then any character between x and y, inclusive, will match.
|
||||
<br>
|
||||
\x - Matches the single character x. This provides a way of avoiding the special interpretation of the characters \*?[] in pattern.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=hidden id=edit_int title="Edit int">
|
||||
|
@ -163,6 +163,14 @@ var schema = {
|
||||
negate: true,
|
||||
def: ""
|
||||
},
|
||||
series: {
|
||||
'class': 'folder',
|
||||
type: 'noarg',
|
||||
desc: 'Folder was created by series recording',
|
||||
idesc: 'Folder was not created by series recording',
|
||||
negate: true,
|
||||
def: ""
|
||||
},
|
||||
'or': {
|
||||
'class': 'all',
|
||||
type: 'composite',
|
||||
@ -278,7 +286,13 @@ var macros = {
|
||||
"name": "Emulate Seriesfiler",
|
||||
"type": "folder",
|
||||
"enabled": "1",
|
||||
"criteria": [],
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "series",
|
||||
"arg": ""
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "fileunder",
|
||||
"arg": ""
|
||||
|
@ -319,7 +319,10 @@ function addrule(id, data)
|
||||
|
||||
rule.find('span.comment').html(data.name);
|
||||
if (data.type == 'folder')
|
||||
{
|
||||
rule.find('.commentleft > span.folder').show();
|
||||
rule.find('.foldercomment').show();
|
||||
}
|
||||
else
|
||||
rule.find('.commentleft > span.file').show();
|
||||
rule.attr('type', data.type);
|
||||
@ -352,7 +355,7 @@ function addrule(id, data)
|
||||
return rule;
|
||||
}
|
||||
|
||||
function edit_text(obj, title, text, callback)
|
||||
function edit_text(obj, title, text, callback, typ)
|
||||
{
|
||||
$('#edit_text_field').val(text);
|
||||
$('#edit_text').dialog({
|
||||
@ -381,6 +384,9 @@ function edit_text(obj, title, text, callback)
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.edit_text_help').hide();
|
||||
if (typ)
|
||||
$('#edit_text_help_' + typ).show();
|
||||
if (text == 'Enter text here...')
|
||||
$('#edit_text_field').focus().select();
|
||||
}
|
||||
@ -470,7 +476,7 @@ function edit_clause(obj)
|
||||
$(obj).html(text);
|
||||
rulerefresh($(obj).closest('div.rule'));
|
||||
changed(1);
|
||||
});
|
||||
}, schema.criterion[cmd].type);
|
||||
break;
|
||||
case 'int':
|
||||
b = tval.split(" ");
|
||||
|
Loading…
Reference in New Issue
Block a user