File Name Pattern Variables, Renaming Strings, Post-Processing


#1

I am seeking a list (or link to a list) of all the variables or strings we can be using in our naming scheme, perhaps additionally their behavior, affect, etc. Additionally, any special characters to avoid, syntax, functions, etc, which may be available.

I have just searched google, and these forums, the wiki, extensively, but could not find. I wouldn’t mind creating a nice wiki article on all the variables used throughout the sickrage system, if I have access to the list of them, and do some trial-and-error on my end (and should probably have a few developers verify it once its complete before turning it public). It would be nice if this list could be placed as a tooltip on the naming settings page also.

What sparked me upon this journey was my realization that when you request a %Y (Year) variable, it uses the Year of the episode’s release date, “Episode Year”. BUT, there is another Year which may be important, the “Show Year”, year the first episode came out (the one to distinguish say the old MacGuyver stuff my parents knew from long ago, and the new MacGuyver series from somewhere in '16,17or18, not sure, whatever).

In my case specifically, I am attempting unsuccessfully, to have the following naming scheme work:
/mnt/4TB/MEDIA/TV/%SN (%y)/%SN (%y) S%0S/%SN (%y) - S%0SE%0E - %EN [%QN]
and it comes out like this:
/mnt/4TB/MEDIA/TV/Show Name (2011)/Show Name (2011) S02/Show Name (2011) - S02E03 - Ep Name [720p HDTV].ext
which looks fine and dandy to the naked eye, BUT, here’s what happens:
Sickrage then creates a new parent directory for EACH YEAR, so, in the case of American Dad! for example, I am desiring a SINGLE folder in the TV directory, called “American Dad! (2005)”, but as I am running a backlog of it, I am seeing so far five folders; “American Dad! (2008)” “American Dad! (2014)” “American Dad! (2016)” “American Dad! (2017)” “American Dad! (2018)” [x being arbitrary number] folders. Emby has no idea what to make of this, it cannot have two parent directories for a single show.

Lastly, probably lots of interesting things I’d imagine can be done for splitting things like “Quality”, and “Resolution”, “FPS”, which people might really enjoy playing around with.

EDIT:
SR Version: 9.4.58
SR GIT Commit: 171203929a53952a42905fc07f511c6fb81faf41


#2

Ok let me take care of this once I get into the office


#3

Basically looking to make or reference a tag/field/property variable map, if there is anything at all anywhere. Even if you point me to a page of code and say "Here, this is what a variable looks like, here’s how its acquired, go nuts, and I’ll search through the whole thing indexing them as I go


#4

It’s actually in the app on the same page you setup the naming, click on the legend icon


#5

Thanks, I missed it before, I found it after a few “closer looks” For anyone else looking, the “legend” icon is the icon at the left side of the “file name” entry box (below the drop-down selection of patterns). The word “NOTE:” is literally right under it.

Kind of difficult to find, may want to just have a blue link that says “Legend” under the text entry box, which then does the same thing.

Also, unfortunately, this does not complete the question, I’d like to know of a “Show Release Year” variable I can input into this, as inputting “%Y” (an un-listed variable) uses the airdate year of that specific episode it is processing, not the show year.

  1. Ideally, when first adding new shows, I wish there was an “Add Show Year (if not already in title)” option, so I wouldn’t have to rename each folder later on and mess everything up.
  2. Second, I’d like the show year variable to be available for post-processing episodes as: “Show (Show-Year) S##/Show (Show-Year) S##E## Episode-Title [Quality].ext”
  3. Lastly, and considering that neither of those exist, what would be really incredible is if there was a “rename all shows adding (YEAR)” option to have the show’s year included in their top directory name so I wouldn’t have to re-name the ones that already exist. It would need to avoid duplicates like “Show-Name (Show-Year) (Show-Year)” for shows that have (YEAR) in their title. This would be complicated as it would then need to go into every NFO XML file and alter the reference paths therein to include new path to the files and the fanart files. I would have to then have Emby rebuild its entire library after a stunt like this, as I’m sure it would only get about half of the links successfully.

But you’re not gods nor am I capable of financially backing said desired function, so I doubt this will happen any time soon, the first two options would be easy to implement, considering that the show year is already a variable somewhere within SickRage, but it is just not here in the “legend”.

Again, if pointed to a script that includes or uses ALL (or most) of the variables in the program, I would happily try to find out what each one is for, give a good English description of it, and propose a way of inputting it to the File Name entry box.


#6

I can take a look at the code, I see no reason why I can’t add this in for you, naming of episodes and season folders would be the extent of what it would cover tho via episode naming which would cover post-processing and episode renaming functions of the app, I can add a option to allow appending of the show year to the show folder as well for when adding new shows.

Does that work ?


#7

That would be amazing thank you very much!! Let me know if there’s anything I can do to help :slight_smile:


#8

As far as adding the show year, it would be much like the “Strip show year” function which “only works on shows that have the year in the title”. But it would be the opposite, so that every new show has the year placed in brackets after a space behind the show name.

Eg:
American Dad! (2005)
The Flash (1990)
The Flash (2014)

In the first and second shows, the " (YEAR)" can simply be appended to the “%SN” variable (show name. BUT, in the Third example, “The Flash (2014)” is already in the %SN, so one would have to avoid “%SN (YEAR)” as it would result in “The Flash (2014) (2014)”. (de-duplicate show year). Also note you should not simply use a “if parser finds four digits at end of show name” function to determine de-duplication, as “SeaLab 2021” (started in 2000) would then lose out on either part of its title or the year wouldn’t add to it. A ‘preview folder name’ function (or even simpler, a “rename folder to use”) while adding new shows would be easy enough. As far as a large library re-name, possibly a mass-rename option to include the show’s premiere date in the show folder?" Just a couple thoughts.


#9

After a bit of Google searches (Googling?) , I didn’t find much for SickRage’s (or SickBeard’s) handling of Episodes which span across two or more files (Split for fitting on multiple disks, or downloading in partial, small files). I would like to know the best naming convention to use for ideally the automated post-processor to pick this up, but at the moment manual processing of it.

So, an episode, say
“Caprica S01E01 - Pilot.mp4”
came down the line as two files, titled:
“Caprica S01E01 - Pilot Pt1.mp4”
“Caprica S01E01 - Pilot Pt2.mp4”
And the automated thing isn’t picking it up well, and I’ve tried a few different conventions for naming partial files to no avail, was wondering if anyone else has had any luck with this sort of thing.

A few other name for this sort of thing is: (for all of Google to reach this post)
Multi-File Episodes
Partial-Episodes
Part-of-Episodes
Split-Episodes

Not:
Part-Episode
Multi-Episode Files
Continuing-Episode
Continued-Episode


#10

Okay, so neat solution, I ended up going into the TV Show’s directory, into the season folder, Manually renaming (quickly) the “Caprica - S01E01 - Pilot [SDTV]”(.ext) files all to “Caprica - S01E01a - Pilot [SDTV]”(.ext), (note the “a” after the episode number).
I then renamed the second partial file of the episode, to “Caprica - S01E01b - Pilot [SDTV].mp4”, and copied it into the TV Show’s season directory.

I don’t know if it was SickRage, or if it was Emby, but one of the two, built a set of metadata for the second episode, and made a “Caprica - S01E01 - Pilot [SDTV].nfo” for both combined. I am about to delete the “Caprica - S01E01a - Pilot [SDTV]”(.ext) files so their internal links are re-created properly. But that seemed to work somehow :slight_smile: Emby sees the two partials and can combine them, and write metadata for the two partials, and a meta for the complete episode.


#11

Didn’t even need to delete the NFO for it to be re-written, took a look inside it with a text editor and it was already mapped to the S01E01a file properly, impressive :slight_smile:


#12

OK, I’m pushing a new release to develop branch, please test and let me know if this is what you wanted.
You can read the commit message to see the changes I made :slight_smile:


#13

Epic thank you so much!! My srever is suuuuper slow but I’ll see how it goes and let you know as its going. So to get to the developer branch I just need to make sure it has the right paths to git, pip2, and switch to developer branch in the general tab?

And if I go to Developer branch can I switch back once the addition you’ve made gets approved to the master stream?


#14

Yup, that’ll do it :slight_smile:


#15

Righteous!! I’ll let you know either late tonight or tomorrow how it goes, its importing four seasons of a show atm, so might…take…time :stuck_out_tongue:


#16

EPIC!! Perfect, your button to “Append Show Year to Show Folder”, on step 3 of the “Add New Show” process. This will help SO much. And I’ve tested it, and it worked perfectly for Mythbusters, it created a directory “Mythbusters (2003)” as expected.

One thing I did notice though, when you only select that option, and alter none of the other settings (brought up by a previously-saved default), the option “Save As Defaults” stays grayed out. I noticed when I clicked any other option, (like setting Preferred Quality from Any, to 1080p, and back to Any), the button turned on, and when I clicked it, it said “Setting Saved” [or something similar]. But, when adding the next show, I found out that the Append Year setting does not save to a default configuration. So for anyone reading this please remember to click that button every time.

To me this is perfect and I am super happy. If the adding a default variable for that setting is too much then don’t worry about it, the problem is solved for all future-added shows. That literally cut down about 5-10 minutes of time per show that I needed to spend to re-name the folder if I didn’t think to add the year from the start. I still need to do it for the ones I’ve already added but that’s not a problem. The problem mainly comes up when I’ve done something so horrific to my library that I literally need to start from scratch lol (happened a few times before). I had basically given up on these extra steps because of how long it takes to do them. I’m glad this feature is now here, and I hope to see it pushed to the master release, (and eventually maybe added to a default setting list). You’re amazing!!

Details:
SR Version: 9.4.69.dev1
SR Install Type: GIT (probably matters)
Git Commit: 2f89453ad18ae9bbf5008dd875ff41799b9a82c9
Python: 2.7.15+
OS: Ubuntu 18.10

On switch to Development branch, I first ensured that nothing was downloading, nothing was post-processing. Then on the “Advanced” tab of the “General Settings” page, I checked that I had both Pip2 path, and the Git paths (/usr/bin/pip2 and /usr/bin/git respectively) both verified by SickRage, I did a backup of my configuration (to a known location!) and waited for it to say SUCCESSFUL. I then switched the branch to Develop (or similar) from Master. I then clicked “Checkout Branch” (restart required, but SR will do this on its own). I waited, the webGUI died, as expected, and waited a while more, then checked to see if SR was running, “sudo systemctl status sickrage” (I have it installed as a service, others may have a different starting method), and it said it was “Inactive”, and had been for some time, this means SR was successful at shutting itself down, but not at re-starting. So, “sudo systemctl start sickrage”, and in about 10 minutes, SR WebUI was once again available.

About it not re-starting entirely on its own, I do not have the “No Restart” option on the “Advanced” tab of the “General Settings” page enabled, it is disabled, or grey, unchecked. I do not know if this has anything to do with it. It is described as “Shutdown SiCKRAGE on restarts (external service must restart SiCKRAGE on its own).”

In regards to such a quick switch between branches after clicking the “Checkout Branch”, I believe it is a scripted instruction to immediately do so, rather than wait until a scheduled update occurs.

I hope that these little bits of info help anyone who may experience any issues with this new and amazing feature that @echel0n has implemented into this spectacular software. Please be DETAILED if you do, how you got there, all your stats, any error messages, etc. I hope I was not overly-detailed and apologize if that has been the case.


#17

Pushing new release now that allows you to save adding show year as a default new show option :slight_smile: