Page 1 of 1

Replace multiple characters?

Posted: 15 Jan 2020, 16:30
by Azhrei
Here's my code currently:

Code: Select all

{n.colon('꞉ ')} - {s00e00} - {t.colon('꞉ ')}{if (ext == 'srt')'.en'}
In addition to colons, I'd like to have slashes replaced with a separate particular character but from what I've read, can't figure out how to accomplish both. Is there a way I'm missing? Any help would be appreciated, thank you!

Re: Replace multiple characters?

Posted: 15 Jan 2020, 18:55
by rednoah
e.g.

Code: Select all

n.colon(' - ').slash(' - ')

Re: Replace multiple characters?

Posted: 16 Jan 2020, 00:01
by Azhrei
rednoah wrote: 15 Jan 2020, 18:55 e.g.

Code: Select all

n.colon(' - ').slash(' - ')
I tried that, but for the show in particular I'm attempting, it's not working regardless of the character I select to replace the /

Fate/Grand Order: Zettai Maju Sensen Babylonia
https://www.imdb.com/title/tt9525238/

Re: Replace multiple characters?

Posted: 16 Jan 2020, 00:35
by kim
There is no slashes to replace ;)

Code: Select all

{n}
Fate Grand Order - Absolute Demonic Front: Babylonia
btw: maybe try

Code: Select all

{plex.tail.derive{ext == 'srt' ? '.en' : ''}}
or

Code: Select all

{plex.tail.derive{ext == 'srt' ? '.en' : ''}.name}
OR

Code: Select all

{kodi.tail.derive{ext == 'srt' ? '.en' : ''}}
or

Code: Select all

{kodi.tail.derive{ext == 'srt' ? '.en' : ''}.name}

Re: Replace multiple characters?

Posted: 16 Jan 2020, 14:32
by rednoah
Ah, yes, there might be some top-level clean-up functions that apply to all bindings, such as removing / so you can't accidentally organize things into accidental folder structures.

Re: Replace multiple characters?

Posted: 17 Jan 2020, 14:44
by Azhrei
Thanks for the replies. I tried switching to {plex.tail.derive{ext == 'srt' ? '.en' : ''}} but it changed where the file was located so I ended up keeping the if command. On a similar topic, I changed my code to:

Code: Select all

{n.colon('꞉ ').asciiQuotes().replace('?', '')} - {s00e00} - {t.colon('꞉ ').asciiQuotes().replace('?', '')}{if (ext == 'srt')'.en'}
Trying to rename this Dragon Ball Super episode:

Teacher and Student Reunited - Son Gohan and "Future" Trunks
https://www.thetvdb.com/series/dragon-b ... es/5656826

But the quotations don't appear in the rename. Am I misunderstanding what that .asciiQuotes() function does?

Re: Replace multiple characters?

Posted: 17 Jan 2020, 15:33
by rednoah
:idea: String.asciiQuotes() will convert unicode quotes to ASCII quotes, replace “ ” with " " and ‘ ’ with ' ' and so on.

:idea: " is not allowed in file paths. If your format yields " as part of the file path, then it'll be removed. Both GUI and CLI should make that quite clear, either through a dialog, or via logging.