[sweeper] Custom rules to manage recordings


Staff member
Sweeper is a Custom Firmware package for managing recordings in a variety of ways using custom rules. It started life as a simple utility for tidying up one-off recordings in the top level of the My Video area into folders, hence its name, but has since evolved into a multi-purpose tool.

The documentation for Sweeper is maintained on the Wiki at http://wiki.hummy.tv/wiki/Sweeper

A couple of example rules from my box:

Sweeper version 1.0.19 is now available.
  • This version adds a new rule action to delete matched recordings which allows for even more inventive automatic expiring of recordings for those who need it;
  • The rule action editor now shows context help for the parameter, and greys out the parameter box when it isn't applicable;
  • The actions which move recordings can now take an absolute path as well as a relative one. This makes it possible to automatically archive recordings off to an external disk through sweeper rules. @sceptic - this should make your automatic NAS archiving possible;
  • The icon has been tweaked a bit to move it down so that it looks more lined up with the others.
If anyone has any examples of how they are using sweeper that they'd like to share, please do - it could help others find solutions they didn't know were possible! : )
Great stuff @af123. Regarding absolute paths, just wondering what would happen to the sweep if the external disk was not available (or became unavailable) for some reason? Ideally the sweep would be skipped until the action target became available again. I was also wondering what would happen to a move if it failed for some other reason, like insufficient space perhaps?
If you used move or fileunder then they would skip the action if the target directory didn't exist, but if you used the create versions of those then they would create the folder where the NAS should be mounted. That could be a problem but it could be solved if there was a fileexists condition...

If the move failed then processing would stop, but you could end up in a situation where some of the files that make up a recording have moved but others haven't - so the .nts could be on the external disk with the .ts remaining on the internal.
Not actually possible to make it atomic. I'd need to implement a destination size check or rollback or copy-and-then-delete if it's a cross-filesystem move. I'll look into it.
Sweeper 2.0.0 released:
  • General support for and and or clauses within a rule allowing more complex logic (see the screenshot I've added to the first post for an example of a rule with an additional or clause. Clauses can be nested if required. Technically the backend allows clauses to be negated too but I don't think there's any need for that so the GUI won't allow it;
  • New mechanism for moving files around with improved error detection and recovery. Moves that cross filesystem boundaries (such as those to an external or network mounted drive) are now implemented as a copy followed by a delete. The delete is only performed if all parts of the recording were successfully copied;
  • New actions - copy & copycreate;
  • More explanatory tooltips when hovering over buttons in the web interface;
  • Sample sweeper.conf file no longer included in package. Example rules can be added through the web interface.
After the "Then delete recordings", I think there is a missing clause "And: secure erase HDD".

Go on - show us the raw code!
Go on - show us the raw code!

# No!!!!!!!!!!!!!!
or {synopsis {one direction} and {synopsis 1D or {synopsis {Niall Horan} synopsis {Zayn Malik} synopsis {Liam Payne} synopsis {Harry Styles} synopsis {Louis Tomlinson} } } } action delete

It took about 10 minutes to update the backend to support or/and but about two hours to work it into the GUI!
All that work to make sure recordings you're not going to make in the first place get deleted if you record them by accident! ;)
The update to v2.0.0 appears to have wiped the existing sweeper.conf on both my HDRs. Is this intentional? Not a problem as they weren't that complex and I can re-make them easily enough.
Me too! Thanks for alerting me to this.

The "add new rule" dialogue doesn't seem to work either (IE8).

Seems OK in Chrome though, in fact there is quite a lot missing from the Sweeper Rules page in IE8, maybe a refresh problem.
Anyone have any rules they'd like to share?
The original intention of Sweeper:
Note that without the initial "[" in the destination folder name, flatten would then return the recording to My Video, where sweeper would put it back... Alternatively, mark the destination folder with the "no-flatten" flag (create the folder in advance and make the Sweeper rule "move" rather than "move and create").
The update to v2.0.0 appears to have wiped the existing sweeper.conf on both my HDRs

All rules set up on both HDRs gone, at the top level.

However, rules set on sub-folders still present ... but not processing.

(EDIT) All rules now restored and working again, thanks to af's fix in 2.0.2 :)
Sorry - an unintentional side-effect of removing the default sweeper.conf file from the package. I didn't expect it to remove the locally modified one!

Sweeper 2.0.0 is also broken on IE, thanks to 'delete' being a reserved word that IE doesn't like even on the left hand side of a map. All other browsers are ok.
Both issues fixed in 2.0.2.
Those of you who have lost your sweeper rules should find them in a file called /mod/etc/sweeper.conf-opkg.backup. If that file exists and you don't have a sweeper.conf, then it will automatically be restored for you; otherwise, if you have re-created your sweeper.conf in the meantime, you will have to reconcile the two by hand.
Unable to save config rules in Chrome on both Android and IPad. Chrome windows seems OK.

Sent from my iPad using Tapatalk
I've tried to create a rule to move mpg copies of recordings (made using WebIf) from their original folder to an existing folder called Copies. When I test configurations based on filename or synopsis it appears Sweeper is only looking at the .ts file and ignoring the .mpg copy.

Is there any way of writing a Sweeper rule to automatically move .mpg copies as this would speed up the process of getting multiple .mpg copies off the Humax onto my tablet for viewing on the move?