How do I edit the built-in subt

Support for macOS users
Post Reply
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

How do I edit the built-in subt

Post by rrspurlock »

A quick question... how/where do I edit the built in subt? Is this possible?

Thank you!
User avatar
rednoah
The Source
Posts: 23350
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I edit the built-in subt

Post by rednoah »

:idea: Built-in bindings such as {lang} and {subt} subtitle language tag cannot be edited. You can however just not use built-in binding and write your own code instead.


:?: What are you trying to achieve? Feel free to elaborate.
:idea: Please read the FAQ and How to Request Help.
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

Re: How do I edit the built-in subt

Post by rrspurlock »

That is very helpful - I've been searching too long!

I would like to expand the file name pattern matching for subtitles and then new names. As an example:

1_eng,English.srt
2_eng,English [Forced].srt
3_eng,English [SDH].srt

... all three are mapped & renamed to:

Title.eng
Title.eng
Title.eng

If I rename the Forced and SDH files producing:

1_eng,English.srt
2_eng,English-Forced.srt
3_eng,English-SDH.srt

... the are mapped & renamed to:

Title.eng
Title.eng.forced
Title.eng.SDH

So if I rename the files before FileBot matching, works like a charm as configured. I was curious if I could produce the final file names without pre-renaming them before add/matching in FileBot.
User avatar
rednoah
The Source
Posts: 23350
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I edit the built-in subt

Post by rednoah »

Well, this is pretty bad and unusual...

Code: Select all

1_eng,English.srt
2_eng,English [Forced].srt
3_eng,English [SDH].srt


:arrow: If you all your files follow this pattern, then Match information from the file path is the way to go:

Format: Select all

{
	if (f.subtitle) '.' + fn.match(/_([a-z]{3}),/)
}
{
	if (f.subtitle) '-' + fn.match(/\[(.+)\]$/)
}

Code: Select all

.eng-Forced
:idea: Please read the FAQ and How to Request Help.
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

Re: How do I edit the built-in subt

Post by rrspurlock »

I completely agree - honestly, these source filenames are frustrating to deal with.

Where would I be "pasting" this code? And would this be applied to every file individually?

Thank you so much - this is amazing!!!
User avatar
rednoah
The Source
Posts: 23350
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I edit the built-in subt

Post by rednoah »

You'd add it to your custom format:
https://www.filebot.net/naming.html

Screenshot



:arrow: I recommend spending ~15min watching all the video tutorials if you're new as this will save you time in the long run:
https://www.filebot.net/tutorials.html
:idea: Please read the FAQ and How to Request Help.
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

Re: How do I edit the built-in subt

Post by rrspurlock »

I greatly appreciate your help - this completely rocked!!!

Thank you so much - FileBot is just amazing!!!
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

Re: How do I edit the built-in subt

Post by rrspurlock »

Oops, one more... this is what I have:

{drive}/Media/{plex.id}
{
if (f.subtitle) '.' + fn.match(/_([a-z]{3}),/)
}
{
if (f.subtitle) '-' + fn.match(/\[(.+)\]$/)
}

... is producing:

Title.eng.eng
Title.eng.eng-Forced
Title.eng.eng-SDH

What syntax change would remove the additional ".eng"?

Appreciate your patience and assistance here.
User avatar
rednoah
The Source
Posts: 23350
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I edit the built-in subt

Post by rednoah »

:idea: The {plex} format already includes the subtitle language and subtitle tags if the file names allow for auto-detection to work. So if your custom code then adds another ".eng" then you will end up with ".eng.eng".


:idea: This code matches this bit: 2_eng,English [Forced].srt (i.e. the 3 lower-case letters between _ and , characters; you can remove this bit of code if you don't want to match this bit from the file name)

Format: Select all

{
	if (f.subtitle) '.' + fn.match(/_([a-z]{3}),/)
}

:idea: This code matches this bit: 2_eng,English [Forced].srt (i.e. the letters enclosed in [...] at the end of the file name; you can remove this bit of code if you don't want to match this bit from the file name)

Format: Select all

{
	if (f.subtitle) '-' + fn.match(/\[(.+)\]$/)
}

:idea: If your files names are good enough for {plex} to work, then you don't need some or all of your Match information from the file path custom code.


:idea: If you want {plex} but not the subtitle bit (if any; so you can add that bit yourself with your own custom code) then the manual will help you get started:
rednoah wrote: 12 Sep 2016, 10:03 e.g. Movies/Avatar (2009)/Avatar (2009) (i.e. {plex} without subtitle language suffix)

Format: Select all

{ plex ^ null }
e.g. Movies/A/Æon Flux (2005)/Æon Flux (2005)
:idea: Please read the FAQ and How to Request Help.
rrspurlock
Posts: 6
Joined: 27 Jul 2024, 13:31

Re: How do I edit the built-in subt

Post by rrspurlock »

Okay, got it - these apply sequentially. Removing the first of the two stanzas nailed it and provided normal FileBot excellence on the other file types and the base name.

FileBot is simply fantastic!
Post Reply