Page 1 of 1

Need help on a very simple formatting request

Posted: 31 Jan 2020, 11:13
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!

Re: Need help on a very simple formatting request

Posted: 31 Jan 2020, 12:44
by rednoah
I think the first built-in example movie format covers this specific case.

e.g.

Code: Select all

n.colon(' - ')

Re: Need help on a very simple formatting request

Posted: 31 Jan 2020, 16:23
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

Re: Need help on a very simple formatting request

Posted: 31 Jan 2020, 17:00
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

Re: Need help on a very simple formatting request

Posted: 31 Jan 2020, 17:21
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, '*'

Re: Need help on a very simple formatting request

Posted: 31 Jan 2020, 21:16
by rednoah
e.g.

Code: Select all

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

:idea: replaceAll and removeAll work with regular expressions, but replace works with literal values.

Re: Need help on a very simple formatting request

Posted: 01 Feb 2020, 01:36
by Sketchy
Perfect, thank you!