'pt-BR' on .srt files gets deleted?

All about user-defined episode / movie / file name format expressions
Post Reply
XBit
Posts: 1
Joined: 13 Jul 2024, 18:42

'pt-BR' on .srt files gets deleted?

Post by XBit »

Hi!
I'm new to FileBot... please bear with me.

I'm renaming some files with Brazilian Portuguese language files and I noticed, that the 'pt-Br' part gets totally stripped. So let's say I have the movie 'Garfield.mkv' with the corresponding 'Garfield.pt-BR.srt' file, I just get 'Garfield (2002).mkv' and 'Garfield (2002).srt' after renaming.

I tried it with and without custom preset but, at the end, I would like to integrate it in this one

Code: Select all

{ drive }/NVIDIA_SHIELD/Media/Movies/ {collection+'/'}{n} ({y}) {' (' + fn.matchAll(/extended|uncensored|uncut|directors[ ._-]cut|remastered|unrated|special[ ._-]edition/)*.upperInitial()*.lowerTrail() } { plex.id }
There is for sure a way to preserve the language code?

Any help is highly appreciated!
User avatar
rednoah
The Source
Posts: 24009
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 'pt-BR' on .srt files gets deleted?

Post by rednoah »

The target file path, including the pt-BR bit, is up to your custom format. The {plex} format and {subt} subtitle language tag would normally take care of that. Unfortunately, pt-BR is not a recognized language code, so neither {subt} nor {plex} will for out-of-the-box in this particular case.


:idea: You can however match arbitrary information from the file path, so you can match the trailing pt-BR bit at the end of a subtitle file like so:

Format: Select all

{ f.subtitle ? fn.match(/[.][a-z]{2}-[A-Z]{2}/) : null }

:idea: The established language code for Brazilian Portuguese is .pob so you may prefer to use that instead:

Format: Select all

{ f.subtitle && fn.endsWith('pt-BR') ? '.pob' : null }



EDIT:

FileBot r10351 adds support for the .pt-BR language suffix to make {plex} and {subt} work out-of-the-box for this kind of filename.
:idea: Please read the FAQ and How to Request Help.
Post Reply