Need help on a very simple formatting request

All about user-defined episode / movie / file name format expressions
Post Reply
Sketchy
Posts: 8
Joined: 31 Jan 2020, 10:49

Need help on a very simple formatting request

Post by Sketchy »

Hey guys, I have a very basic format that I've been using for about a year now and I only ever encounter one problem with it so I'm hoping someone can help me make a very easy/basic addition to my format.

My current format:
{n.upperInitial} {s00e00} - {t}

What I cant seem to figure out how to do on my own even after reading through some examples etc, is how to make it automatically replace any instances of colons with a SPACE followed by a DASH in either the Name OR Title.

For Example
Hercules: The Legendary Journeys S01E01 - The Wrong Path
Should become
Hercules - The Legendary Journeys S01E01 - The Wrong Path

Much appreciated!
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help on a very simple formatting request

Post by rednoah »

I think the first built-in example movie format covers this specific case.

e.g.

Code: Select all

n.colon(' - ')
:idea: Please read the FAQ and How to Request Help.
Sketchy
Posts: 8
Joined: 31 Jan 2020, 10:49

Re: Need help on a very simple formatting request

Post by Sketchy »

Yes I already tried using that (I looked through https://www.filebot.net/naming.html) before I posted and could not get it to work. I tried a number of ways, including:

{n.colon(' - ')} {s00e00} - {t}
{n.upperInitial.colon(' - ')} {s00e00} - {t}
{n.upperInitial().colon(' - ')} {s00e00} - {t}

Filebot is fine with the syntax in all 3 examples, in that it saves the preset just fine, but none of those actually work to remove the ":", and the end result is still
Hercules: The Legendary Journeys S01E01 - The Wrong Path
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help on a very simple formatting request

Post by rednoah »

Perhaps you could add screenshots for context?
viewtopic.php?t=1868


As far as the format is concerned, it definitely works:

Code: Select all

$ filebot -list --db TheTVDB --q "Hercules: The Legendary Journeys" --format "{n.colon(' - ')} {s00e00} - {t.colon(' - ')}"
Hercules - The Legendary Journeys S01E01 - The Wrong Path
Hercules - The Legendary Journeys S01E02 - Eye of the Beholder
Hercules - The Legendary Journeys S01E03 - The Road to Calydon
:idea: Please read the FAQ and How to Request Help.
Sketchy
Posts: 8
Joined: 31 Jan 2020, 10:49

Re: Need help on a very simple formatting request

Post by Sketchy »

Ok nvm, for whatever reason it did not work when I used the "Edit Preset" option, but it did work when I changed the format by clicking "Edit Format" after clicking the "Match" button. What I ended up with was
{n.upperInitial().colon(' - ')} {s00e00} - {t}

Thanks! Amazing program btw. Been using it for under a year and its been used to rename ~23K files.

How would I go about making the episode titles remove instances of "?" and replace instances of "*" with "#" ?
As for the removing "?" I tried the following, which did not work
{t.removeAll('/?')}
{t.removeAll('/?/')}

and as for replacing *'s with #'s, everything I attempted gave me a syntax error of some kind.
.replaceAll('*','#') for example, gives me an error about a dangling metacharacter, '*'
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help on a very simple formatting request

Post by rednoah »

e.g.

Code: Select all

n.replace('?', '').replace('*', '#')

:idea: replaceAll and removeAll work with regular expressions, but replace works with literal values.
:idea: Please read the FAQ and How to Request Help.
Sketchy
Posts: 8
Joined: 31 Jan 2020, 10:49

Re: Need help on a very simple formatting request

Post by Sketchy »

Perfect, thank you!
Post Reply