Page 1 of 1

Add Special Characters to Show Title

Posted: 13 Jan 2015, 19:54
by manicjonah
I am just starting to learn how to use FileBot and could use a little help. I want the software to run automatically against my Recorded TV folder so I am working on a script that calls FileBot to do what I need. Some of what I need seems to involve Groovy scripts and regular expressions -- stuff that I'm not very familiar with.

So to get things started I'm hoping someone will tell me how to add a hyphen to a show title. I know that sounds simple but there are some stipulations:

I only need to do this for one show but my script will run against the entire Recorded TV directory
I need the hyphen in a particular part of the episode name. When Filebot grabs the show from TVRage it removes the forward slash in the episode name and leaves a space. I want the forward slash or a hyphen instead of the space.

My source file is named like this: Rabbids Invasion_NIKHD_2014_04_26_11_28_00.wtv

Filebot renames it to: S01E21- Rabid 2.0 Rabbid Undies Sneezy Rabbid

I want: S01E21 - Rabbid 2.0/Rabbid Undies/Sneezy Rabbid or S01E21 - Rabbid 2.0 / Rabbid Undies / Sneezy Rabbid or S01E21 Rabbid 2.0 - Rabbid Undies - Sneezy Rabbid

but I don't know how to add the slash or dash to just that part of the title. Each episode consists of 3 small episodes. The episode number will always change, the small episode titles will change. Any help you can give me is much appreciated. Again, this naming convention only applies to one of the shows I record but will be fit into a script that runs against my entire Recorded TV folder.

Thanks

MJ

Re: Add Special Characters to Show Title

Posted: 14 Jan 2015, 12:47
by manicjonah
I've been second guessing my request for help and wonder if what I asked for is too much. IF what I'm asking for is too much please consider helping me simply add the dash (or slash) where I need it in the episode title. I worked out a way to prevent all of my other shows (aside from Rabbids Invasion) from not getting the dash or slash added to the episode title.

Thanks

MJ

Re: Add Special Characters to Show Title

Posted: 14 Jan 2015, 18:01
by rednoah
No worries, this is extremely easy. Just a matter of formatting the name:
http://www.filebot.net/naming.html

In your case, this should work:

Code: Select all

{n} - {s00e00} - {episode.title.tr('/|', '-')}

Re: Add Special Characters to Show Title

Posted: 15 Jan 2015, 19:18
by manicjonah
rednoah, thank you for your reply. I'm afraid what you suggested doesn't accomplish what I need. I looked over the "naming" page again and got a little closer to what I want but I could use more direction. I'm not even sure what I want is possible. I'll clarify:

Episode name on TVRage.com: Rabbid 2.0/Rabbid Undies/Sneezy Rabbid
Name assigned by Filebot: Rabbid 2.0 Rabbid Undies Sneezy Rabbid (same name but the / is stripped

I suspect that FileBot is hard programmed to substitute a space for a slash, but that is making it hard for me to process multi episode shows.

I want the episode name to look like it does on TVRage.com but since / is forbidden in Windows file names I want to replace the / with a -

This is the closest I've come to figuring out how to do what I want, but it's not right:
{s00e00} - {t.space ('-').lower()} gives me this: S01E24 - rabbid-2-0-rabbid-undies-sneezy-rabbid

The problem is that command substitutes a dash for every space. Logic is needed to put the dash where it belongs and I can't think of a way to do that. Not every episode includes the word "rabbid" so it can't be used as a delimeter. Not every episode has a two word title either (some are 1 word, some are as many as 5 words) so . . . I'm not sure how to do it.

I wonder if it's possible to substitute a dash (-) for a slash (/) in the program settings (can't find them)? Any other suggestion you have for making this work would be great.

Thanks for your help here.

MJ

Re: Add Special Characters to Show Title

Posted: 15 Jan 2015, 19:47
by rednoah
1.
First of all, you absolutely don't wanna use \ or / in filenames. You literally can't, and if you do it'll be interpreted as file separator.

2.
{t} is a simple String object which gets normalized automatically, {episode} is not. Plus, it's not the t gets normalized it's that the result of {expression} gets normalized.

3.
What was the result when you tried the solution I gave you?

Code: Select all

{n} - {s00e00} - {episode.title.tr('/|', '-')}
This also works, btw:

Code: Select all

{n} - {s00e00} - {t.tr('/|', '-')}
tr means it'll replace / and | with - and thus the result of the expression will no longer contain any / that would be stripped away.

Re: Add Special Characters to Show Title

Posted: 15 Jan 2015, 22:54
by manicjonah
rednoah,

I screwed this one up pretty good :? .

I thought you might have misunderstood my request when I saw both the forward slash and the hyphen in the command you provided. So I went ahead and modified it and didn't get good results. After I read your last reply I ran the command

Code: Select all

{n} - {s00e00} - {episode.title.tr('/|', '-')}
the way you provided it and saw that it does exactly what I need.

What makes it even better for me is that because it simply finds all instances of "/" in the episode title and replaces it with "-" I don't have to write a separate routine for Rabbids Invasion, I can run the same script against my entire RecordedTV folder.

Thanks very much for your help. I'm very glad to have found FileBot.

MJ