[sweeper] Custom rules to manage recordings

It refused to do the rename and then everything else continued to process.

A few observations about the GUI (using Chome on Win7):
  • Some of the edit boxes open off the left of the screen, and can't be repositioned;

  • Clicking the edit button against a condition only allows the qualifier to be edited, not the condition itself;

  • Ditto the action edit: only the qualifier is editable, not the action.

lastrule {} action {renamefile {%title_%yyyymmdd_%hhmm(%lcn)}}
The GUI inserted this as
Code:
lastrule "" action {renamefile {%title_%yyyymmdd_%hhmm(%lcn)}}
 
A few observations about the GUI (using Chome on Win7):
  • Some of the edit boxes open off the left of the screen, and can't be repositioned;

  • Clicking the edit button against a condition only allows the qualifier to be edited, not the condition itself;

  • Ditto the action edit: only the qualifier is editable, not the action.
I have noticed the mispositioning myself but haven't got around to reporting it before, For me on FF and IE it seems to be ok when adding the first rule but when trying to add another rule the box is larger and partially off screen. I think it is a fairly recent problem.

I agree that is annoying not being able to change condition and having to delete an readd, especially when trying anything complex involving Ands/Ors
 
Sweeper 2.0.8 should fix the window positioning (and if not, will at least allow you to drag the offending dialogue back to where you want it).
 
My wife records loads of American series and then spends ages trying to work out which series and which episode they are by reading the info. I've set up a sweeper rule that looks at the Synopsis and finds the the text (S# Ep.#), but would it be possible to get access to the Episode field? If so could there then be a way to parse the information and file the recording accordingly. i.e. Say the Episode is s7e5 could there be a way to file that in the "Series 7" folder named "Episode 5"?

More Details.png

At the moment I use Sweeper rules on the My Video folder to move the recordings to the right show folder. Then in the show's folder I have this rather ugly set of rules:

Sweeper Rules.png

Thanks

Andy
 
You say it's an ugly set of rules, but that's a perfectly valid way of doing it, and computers have no sense of aesthetics.

What might be generally useful is the means to apply a regular expression search to the various text fields (file name, medial title, synopsis) and use the result as a replacement field in output strings or conditionals.
 
would it be possible to get access to the Episode field? If so could there then be a way to parse the information and file the recording accordingly. i.e. Say the Episode is s7e5 could there be a way to file that in the "Series 7" folder named "Episode 5"?
Yes, that's something I plan to add in the future. I started adding integration with thetvdb.com to try and determine the series and episode name automatically when the broadcaster doesn't put it into the synopsis but that has stalled somewhat. I'll have a look at how easy it would be to implement something without that integration.
 
What might be generally useful is the means to apply a regular expression search to the various text fields (file name, medial title, synopsis) and use the result as a replacement field in output strings or conditionals.
Definitely - I'll bump that one up my to-do list!
I already have it in my local copy but it's ugly and not very user friendly at all in terms of how it is configured.
 
At the moment I use Sweeper rules on the My Video folder to move the recordings to the right show folder. Then in the show's folder I have this rather ugly set of rules:

Upgrade sweeper to 2.0.10, clear your browser cache, and then you can create a rule like this:

Screenshot%202015-09-04%2021.57.01.png


Choose the new 'Numeric comparison' condition and fill the value in like this:

Screenshot%202015-09-04%2022.00.42.png


The new %series token will be set if the series number could be extracted from the synopsis and zero otherwise. Similarly there are new %episode, %episodes, %episodename and %epdescr tokens. See http://wiki.hummy.tv/wiki/Sweeper#Tokens
 
This sounds really useful. We often hive off series for later viewing via plex and I manually rename the files based on the filename.

I trying to set up the rule using the above example, but I getting the following error

intmatch {%series~~> 0} action {movecreate Series}

Can anyone tell what I'm doing wrong?
 
Wow! That was quick work. Thanks!

I've been playing around with it and found an issue with %episodename.
%episodename returns an odd result when there is no total of episodes. i.e. if the Episode field contains something like:
s5e8 - The Greatest Episode
Then %epdisodename expands to "8name".
I can't find any recordings with the number of episodes included in the field, i.e. s5e8/20, to test it on.

From a file I ran the rules on:
Episode Field:
Code:
Episode    s5e8 - Designated Target

Test Output:
Code:
05/09/2015 21:26 - + Sweeper processing /media/My Video/Series 5/NCIS_20150825_1558.ts
05/09/2015 21:26 - Processing [intmatch {%episode~~> 0} action {settitle %episodename}]
05/09/2015 21:26 -    intmatch(%episode~~> 0)
05/09/2015 21:26 - Intmatch (%episode) against (> 0)
05/09/2015 21:26 -   Expanded [%episode] -> [8]
05/09/2015 21:26 -      MATCH
05/09/2015 21:26 -    action(settitle %episodename)
05/09/2015 21:26 - ACTION: settitle(%episodename) [0]
05/09/2015 21:26 -   Expanded [%episodename] -> [8name]
05/09/2015 21:26 - Setting title for /media/My Video/Series 5/NCIS_20150825_1558.ts to 8name
 
That's why I thought regular expressions would be a better solution - fixed extraction rules are likely to be baulked by the irregularity of the data format.
 
I've been playing around with it and found an issue with %episodename.
%episodename returns an odd result when there is no total of episodes. i.e. if the Episode field contains something like:
s5e8 - The Greatest Episode
Then %epdisodename expands to "8name".
Ah yes, it's seeing that as %episode followed by the word name. I just need to reorder the tokens to put episodename first. I'll update the package tomorrow.
 
That's why I thought regular expressions would be a better solution - fixed extraction rules are likely to be baulked by the irregularity of the data format.
The back-end code is using regular expressions to extract the data from the synopsis. I wrote test cases reflecting every format that I saw in use within the EPG data and then constructed patterns to deal with them (and various variations that I haven't seen yet). I'm sure broadcasters will continue to come up with new ways of representing the format in which case I'll extend the pattern matching, but there's nothing to stop you or anyone writing their own regular expression rule within sweeper using a combination of the %synopsis and %rebsub tokens in a numeric match rule (I'll post an example tomorrow).

Here are the patterns I found in the EPG along with the extracted info. This is the output of /mod/webif/ilb/bin/test/episode.

Code:
Episode 5  => S0E5/0  - OK
(8/8)  => S0E8/8  - OK
(Episode 5/10)  => S0E5/10  - OK
(Ep5/10)  => S0E5/10  - OK
(Ep 3 of 3)  => S0E3/3  - OK
(Ep3)  => S0E3/0  - OK
(S2 Ep1)  => S2E1/0  - OK
S.02 Ep.002  => S2E2/0  - OK
S01 Ep52  => S1E52/0  - OK
(S4 Ep 7)  => S4E7/0  - OK
(S1, ep 2)  => S1E2/0  - OK
(S8, Ep2)  => S8E2/0  - OK
(S4 Ep22/24)  => S4E22/24  - OK
23/27.  => S0E23/27  - OK
 
Last edited:
Ah yes, it's seeing that as %episode followed by the word name. I just need to reorder the tokens to put episodename first. I'll update the package tomorrow.
Ignore that, the token is actually %epname. I've fixed the wiki page.
 
Here's the example I promised yesterday. This is definitely not standard or straightforward use of sweeper but it demonstrates the regular expression capability.

Screenshot%202015-09-06%2020.15.15.png

When running this against an episode of Vic The Viking with synopsis:
The Vikings hunt in the forest when they find a colony of stink bugs. After realising the foul smell comes from the insects, they go back home to discover that Sven has invaded the village. S01 Ep29
The debug shows:
Code:
06/09/2015 20:17 - Setting title for /media/My Video/test/Vic The Viking_20150619_0630.ts to 01
that is, the extracted season number.
 
This is the program i'm trying to extract the correct title for . Could you advise on the rule required

Synopsis
1/25. Motor Home: Educational series using Makaton sign language. Mr Tumble is moving to his new home in Tumbleton! Also in HD.

Episode
s?e1/25 - 1/25. Motor Home (Something Special_ We're All Friends)
 
If you want the title of the programme use %title, but that's what the recording is already called. If that's not what you want then you need to give more information on what you do want, i.e. the name of the recording, both filename and what it's called when you look at it on the Humax Media menus, and an example that shows what you want the title to be set to.
 
After tonight's update, Sweeper has started mangling titles and filenames. I think it is related to the rules for removing 'new'. My rules are here:
Code:
# Remove New: from title
global title New:* action {settitle {%orig%regsub,New:\s*,,}}
# Remove New_ from filename
global filename New_* action {renamefile {%orig%regsub,New_\s*,,}}
# Remove *_ * from filename
global filename {*_ *} action {renamefile {%orig%regsub,_ \s*, - ,}}

Auto.log entries here:
Code:
09/09/2015 01:25:23 -   DECRYPT: /media/My Video/Z Nation/New_ Z Nation_20150908_2200
09/09/2015 01:25:23 -   DLNA: http://127.0.0.1:9000/web/media/1163.TS
09/09/2015 01:27:28 -   Removing/binning old copy.
09/09/2015 01:27:28 - Done... 1007.61 MiB in 125.264 seconds - 8.04 MiB/s
09/09/2015 01:28:07 - Setting title for /media/My Video/Z Nation/Z Nation_20150825_2200.ts to Z Natio
09/09/2015 01:28:07 - Setting title for /media/My Video/Z Nation/Z Nation_20150818_2200.ts to Z Natio
09/09/2015 01:28:07 - Setting title for /media/My Video/Z Nation/Z Nation_20150811_2159.ts to Z Natio
09/09/2015 01:28:08 - Setting title for /media/My Video/Z Nation/Z Nation_20150804_2200.ts to Z Natio
09/09/2015 01:28:08 - Setting title for /media/My Video/Z Nation/Z Nation_20150728_2200.ts to Z Natio
09/09/2015 01:28:09 - Setting title for /media/My Video/Z Nation/Z Nation_20150901_2200.ts to Z Natio
09/09/2015 01:28:09 - Setting title for /media/My Video/Z Nation/New_ Z Nation_20150908_2200.ts to Z Nation%reg
09/09/2015 01:28:09 - Setting title for /media/My Video/Z Nation/Z Nation_20150721_2200.ts to Z Natio
09/09/2015 01:28:10 - Renaming /media/My Video/Z Nation/Z Nation_20150825_2200.ts to Z Nation_20150825_220
09/09/2015 01:28:10 - Renaming /media/My Video/Z Nation/Z Nation_20150818_2200.ts to Z Nation_20150818_220
09/09/2015 01:28:11 - Renaming /media/My Video/Z Nation/Z Nation_20150811_2159.ts to Z Nation_20150811_215
09/09/2015 01:28:11 - Renaming /media/My Video/Z Nation/Z Nation_20150804_2200.ts to Z Nation_20150804_220
09/09/2015 01:28:12 - Renaming /media/My Video/Z Nation/Z Nation_20150728_2200.ts to Z Nation_20150728_220
09/09/2015 01:28:12 - Renaming /media/My Video/Z Nation/Z Nation_20150901_2200.ts to Z Nation_20150901_220
09/09/2015 01:28:13 - Renaming /media/My Video/Z Nation/New_ Z Nation_20150908_2200.ts to Z Nation_20150908_2200_reg
09/09/2015 01:28:13 - Renaming /media/My Video/Z Nation/Z Nation_20150721_2200.ts to Z Nation_20150721_220
09/09/2015 01:28:13 - Renaming /media/My Video/Z Nation/Z Nation_20150818_220.ts to Z Nation_20150818_22,
09/09/2015 01:28:14 - Renaming /media/My Video/Z Nation/Z Nation_20150728_220.ts to Z Nation_20150728_22,
09/09/2015 01:28:14 - Renaming /media/My Video/Z Nation/Z Nation_20150721_220.ts to Z Nation_20150721_22,
09/09/2015 01:28:15 - Renaming /media/My Video/Z Nation/Z Nation_20150825_220.ts to Z Nation_20150825_22,
09/09/2015 01:28:15 - Renaming /media/My Video/Z Nation/Z Nation_20150908_2200_reg.ts to Z Nation_20150908_2200_re,
09/09/2015 01:28:15 - Renaming /media/My Video/Z Nation/Z Nation_20150804_220.ts to Z Nation_20150804_22,
09/09/2015 01:28:16 - Renaming /media/My Video/Z Nation/Z Nation_20150901_220.ts to Z Nation_20150901_22,
09/09/2015 01:28:16 - Renaming /media/My Video/Z Nation/Z Nation_20150811_215.ts to Z Nation_20150811_21,
 
To add to the above post (#178), the third sweeper rule above (replace 'underscore space' in filename) is also causing problems now:
Code:
09/09/2015 12:02:25 - autotrigger[20839]: Renaming /media/My Video/Star Trek_ The Next Generation_20150909_1100-dec.ts to Star Trek - The Next Generation_20150909_1100-d ,
I had flagged the 'My Video' folder as 'no-sweep' but this was ignored: was this flag only designed to work on sub-folders?
 
You can temporarily disable sweeper by creating a file called /mod/webif/plugin/sweeper/.disabled
I'm looking into what's causing this now. It looks like it's stripping the last character off : (
 
Back
Top