• The forum software that supports hummy.tv has been upgraded to XenForo 2.1!

    This upgrade brings a number of improvements including the ability to bookmark posts to come back to later. Please bear with us as we continue to tweak things and open a new thread for any questions, issues or suggestions in Site/Forum Issues.

Old sweeper package to file away one-off recordings

Status
Not open for further replies.

af123

Administrator
Staff member
The information in this thread is now out of date with the introduction of the new Sweeper package with web-based configuration. Please refer to the new thread at http://hummy.tv/forum/threads/sweeper-custom-rules-to-manage-recordings.5138/

Sweeper is a package which keeps an eye out for new recordings and files them away automatically for you according to specified criteria. It works for both single one-off recordings which appear at the top level of the My Video tree and series recordings that appear in folders.

At present configuration is manual via a file at /mod/etc/sweeper.conf which will appear in the quick-edit list under Diagnostics->File Editor in the web interface.

The configuration file contains a list of rules, one per line. Each rule list a number of conditions followed by an action to be taken if all conditions are true. A rule which contains only an action is always processed. Rules are processed in order until an action is taken.

Some examples will hopefully make it clearer.

The most commonly requested case - just file all one-off recordings into a folder.

Code:
action {move "archive/miscellaneous"}
This will only work if "archive/miscellaneous" already exists. Changing move to movecreate will cause the folder to be created if necessary.

Here's the configuration file I'm using. It files anything recorded on a children's channel into Children/miscellaneous and everything else into _misc. I use the underscore prefix to put the folder at the bottom of the list. You only need to put quotes around the directory name if it contains spaces.

Code:
lcn {>= 70} lcn {<= 79} action {move Children/Miscellaneous}
action {move _misc}
and here's a bigger made-up example. The configuration file can contain comments prefixed with a # character.

Code:
# Sweep single Big Bang episodes into the series folder
lcn 4 title "Big Bang" action {move "The Big Bang Theory"}
# Don't touch anything from channel 78 over 20 minutes long
lcn 78 duration {>= 21} action preserve
lcn {>= 70} lcn {<= 79} duration {> 20} schedduration {>= 10} title {Kairu} synopsis {Team Hiverax} definition SD size {> 1024} genre Children action {move Children/Miscellaneous}
title {Mother} action {move "Test \"2\""}
title {Greatest} action {movecreate "_misc"}
For an up-to-date and maintained list of the available actions, criteria and tokens, please see http://wiki.hummy.tv/wiki/Sweeper

The available actions are:
  • move - move the recording to a folder.
  • movecreate - move the recording to a folder and create it if it doesn't exist.
  • fileunder (folders only) - look for another existing with the same name as the new series recording and, if found, move the new recordings into it.
  • fileundercreate (folders only) - As fileunder but if no folder is found then create a new one.
  • preserve - do nothing and stop processing rules.
The available criteria are:
  • flag - a flag against the recording, e.g. 'flag New'. Flags are Locked, New, Encrypted, Guidance, ODEncrypted, Shrunk, Deduped.
  • lcn - channel number, e.g. 'lcn 1', 'lcn {> 1}'
  • duration - recording duration in minutes, e.g. 'duration {> 60}'
  • schedduration - scheduled recording duration in minutes.
  • size - size in bytes
  • age - age in hours
  • wage - number of hours since last watched
  • definition - standard (SD) or high (HD) definition, e.g. 'definition SD'
  • title - title contains ..., e.g. 'title {The Big Bang Theory}'
  • synopsis - synopsis contains ...
  • guidance - guidance contains ...
  • genre - recording genre is.. e.g. 'genre Children'
  • hour - hour of recording, e.g. 'hour {>= 21}'
  • lock - always matches but changes the lock status of the recording as a side-effect. Use 'lock 1' to lock and 'lock 0' to unlock.
It is possible to use some special tokens in the folder name supplied to move and movecreatewhich are replaced by values from the recording being handled. These tokens are:
  • %genre
  • %definition
  • %title
  • %channel
  • %lcn
  • %duration
  • %timestamp
So if you wanted to move all single recordings into a folder as if they had been a series recording, you would have a rule which said:

Code:
action {move %title}
Folder Rules

Folder rules are similar to rules for single recordings but are prefixed with the word folder and there are some additional actions that can be taken.

This example replicates the behaviour of the old series-filer package

Code:
folder action {fileunder ""}
Whenever a new folder appears due to a series recording, this rule automatically moves any recordings within it to a folder of the same name elsewhere in the tree if one is found. That means that you can file away series folders in a more structured way and any new episodes will follow them.

You can use the same criteria as for single recordings so if you wanted all children's series to end up under Children/ you could do:

Code:
genre {Children} action {fileundercreate "Children"}
That causes the Children folder to be searched for a folder that matches the new series. If it is found, the new recordings are moved into it but if not then a new folder is created under Children (that's the create part of the action).

Sweeper hooks into automatic processing so actions and diagnostic information will be recorded in auto.log. Increasing the automatic processing debug level will log more information.
 

kevindickinson

Active Member
Think I've managed to crash it?

Installed sweeper OK
Edited the conf file but had a syntax error
Auto.log had error messages trough to when I edited the conf file to correct the syntax
Nothing in the log since and nothing being filed in folders

Will take a better look tomorrow to see what I've done
 
OP
af123

af123

Administrator
Staff member
You can see what it's doing in more detail by running the sweeper/test diagnostic. If it doesn't think there's anything to do then it won't log anything unless you increase the log level for automatic processing in the settings page.

Code:
>>> Beginning diagnostic sweeper/test
Running: sweeper/test
01/09/2013 11:11 - Sweep scan starting for /media/My Video
01/09/2013 11:11 - + Sweeper processing /media/My Video/Tim Minchin and the Heritage____20130824_2338.ts
01/09/2013 11:11 - Processing [# Sweep single Big Bang episodes into the series folder]
01/09/2013 11:11 - Processing [lcn 4 title "Big Bang" action {move "The Big Bang Theory"}]
01/09/2013 11:11 -    lcn(4)
01/09/2013 11:11 -      MATCH
01/09/2013 11:11 -    title(Big Bang)
01/09/2013 11:11 -      Nomatch
01/09/2013 11:11 - Processing [# Move anything recorded from a children's channel to the Miscellaneous folder]
01/09/2013 11:11 - Processing [lcn {>= 70} lcn {<= 79} action {move Children/Miscellaneous}]
01/09/2013 11:11 -    lcn(>= 70)
01/09/2013 11:11 -      Nomatch
>>> Ending diagnostic sweeper/test
 

kevindickinson

Active Member
Thanks.

The diagnostic shows it is working but has "no match"
Think I must have the genre wrong. I used the ones used in to select programmes in rs.
Is there a list of valid genre anywhere?

The line in the conf file I have at present is:

genre {Movie} action {move "Films"}
 
OP
af123

af123

Administrator
Staff member
Think I must have the genre wrong. I used the ones used in to select programmes in rs.
Is there a list of valid genre anywhere?
The genres used in the freeview EPG for upcoming recordings are different to those stored against completed recordings (I have no idea why!). You need 'Film' rather than 'Movie' here. Ezra's link is to the list for completed recordings.
 

Ezra Pound

Well-Known Member
I've added a note to the WiKi:-
Movie.png Film. (Referred to as Movie on screen*)
NOTE * for the sweeper package use Film
 

rg001c7345

Member
This is great - excellent work! :)

I too will be making use of :

genre {Film} action {move "Films"}

Is it possible to file any other single events (not of the film genre) to a folder of the same name?

Rg.
 

Black Hole

May contain traces of nut
Is it possible to file any other single events (not of the film genre) to a folder of the same name?
Of course - just set up a rule to express what you want, based on the examples given.

For example, if on the next line you put
Code:
action {move [Unclassified]}
...all the films will go to "Films" and everything else will go to "[Unclassified]" (in square brackets in my case because I run flatten, and it also puts the folder at the bottom of the list and therefore easy to find).
 

rg001c7345

Member
Of course - just set up a rule to express what you want, based on the examples given.
I don't think I explained myself properly. I would like to setup a rule that automatically looks at the name of the single event and then creates a folder of the same name and files it in there, rather than a generic folder name that I specify.

Rg.
 

Black Hole

May contain traces of nut
Can't do that at the moment, AF might be persuaded to add such a facility if it has legs.

Why would you want to do that? All it will achieve as far as I can see is a whole bunch of folders (containing single files) instead of a whole bunch of files. If the idea is to file away episodes of a series, do a series recording instead of recording each episode individually.
 

Wallace

Traveler 34122
...I would like to setup a rule that automatically looks at the name of the single event and then creates a folder of the same name and files it in there, rather than a generic folder name that I specify.

Rg.

I too would like this feature.
 
OP
af123

af123

Administrator
Staff member
I don't think I explained myself properly. I would like to setup a rule that automatically looks at the name of the single event and then creates a folder of the same name and files it in there, rather than a generic folder name that I specify.
That would be simple enough to add - I'll do an update in the next day or two.
 
Status
Not open for further replies.
Top