How to replace / in the episode title?

All about user-defined episode / movie / file name format expressions
Post Reply
dragonandlance
Posts: 15
Joined: 17 Sep 2017, 22:28

How to replace / in the episode title?

Post by dragonandlance »

Filebot has been working great, but I had a small problem.

I'm trying to get two anime series (Mr. Osomatsu and Haibane Renmei) to match correctly with anidb; each individual episode has multiple segments which have different names, and I want to show this in the file name. So,


Original Titles

Osomatsu-san episode 2 is "Let`s Get a Job / The Melancholy of Osomatsu", and 4 is "Let`s Become Independent / This Is Totoko"

Haibane Renmei episode 1 is "Cocoon / Dream of Falling from the Sky / Old Home" and episode 2 is "Town and Wall / Toga / Haibane Renmei"

Filebot outputs

02 - Let's Get A Job The Melancholy Of Osomatsu and 04 - Let's Become Independent This Is Totoko

01 - Cocoon Dream Of Falling From The Sky Old Home and 02 - Town And Wall Toga Haibane Renmei

What I want

02 - Let's Get A Job &(or -) The Melancholy Of Osomatsu and 04 - Let's Become Independent - This Is Totoko

01 - Cocoon - Dream Of Falling From The Sky - Old Home and 02 - Town And Wall - Toga - Haibane Renmei


Here is my original expression:

Code: Select all

I:/TV Shows/{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[´`‘’ʻ""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[\]]/, " - ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() })}; norm(n)} ({y})/{episode.special ? 'Specials' : 'Season '+s.pad(1)}/{e.pad(2)} - {norm(t).upperInitial().replaceAll(/[?.:]/).replacePart(', Part $1')} [{resolution}]
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to replace / in the episode title?

Post by rednoah »

Presumably, you're trying to ask how to split the title by / and then use a custom separator. The {t} binding will give you a sanitized value that can't include / characters.

You can use the {episode} binding to access the raw title value:

Code: Select all

filebot -list --db AniDB --q "Haibane Renmei" --format "{n} - {e.pad 2} - {episode.title.slash ' & '}"

Code: Select all

Haibane Renmei - 01 - Cocoon & Dream of Falling from the Sky & Old Home
Haibane Renmei - 02 - Town and Wall & Toga & Haibane Renmei
...
:idea: Note that matching is unrelated to formatting.
:idea: Please read the FAQ and How to Request Help.
dragonandlance
Posts: 15
Joined: 17 Sep 2017, 22:28

Re: How to replace / in the episode title?

Post by dragonandlance »

Thank you so much!
Post Reply