Embedded subtitle identified in filename.

Any questions? Need some help?
Post Reply
walker63
Posts: 3
Joined: 23 Dec 2022, 18:20

Embedded subtitle identified in filename.

Post by walker63 »

I have been using Filebot for a while not and have been quite pleased with this custom preset that I use for my Plex movie library.

Code: Select all

{n} ({y}) {" {tmdb-$id}"} - {vf} {vc} {af} {ac}{subt}
If I have multiple English .srt subtitles, and amend the extension for both a forced and hearing impaired subtitle with .sdh.srt & .forced.srt, Filebot renames all three English subtitles perfectly

Like this example…

Code: Select all

Foul Play (1978) {tmdb-15659} - 1080p x265 6ch AAC.eng.SDH.srt
My new goal is to add an identifier to the filename if there are any embedded English subtitles, WITHOUT modifying the media filename if there are also external subtitles being renamed.

I’ve grabbed the following code from this forum post… viewtopic.php?t=4882

Code: Select all

{ textLanguages =~ /eng/ ? 'ENGSUB' : null } }
Using

Code: Select all

{n} ({y}) {" {tmdb-$id}"} { "{edition-${tags.first()}}" } - {vf} {vc} {af} {ac}{subt} { textLanguages =~ /eng/ ? '[ENGSUB]' : null }
Give a results like this…

Code: Select all

The Out-of-Towners (1999) {tmdb-8970} - 720p AVC 6ch AC3 [ENGSUB].mkv
I thought I had hit the Holy Grail of Filebot movie presets to use with my Plex library, but quickly discovered that if a media file has an embedded subtitle that’s listed as und (Undertermined) in the container file, I won’t be aware of that fact during batch renaming.

Is there anyway to look for both, and to have either ENGSUB or UNDSUB placed into the filename depending on which is found?

As an alternative, I’d be just as happy if any embedded subtitle could trigger adding a generic SUB to all media files, no matter what the subtitle is labeled as.

It would be extremely rare to find a media file with an English audio track that also only contained a non-English embedded subtitle file.

Long time user and first time poster to the forum.

In my opinion Filebot is the most important tool for building a Plex media collection, so thank you for the program and any help in this matter.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Embedded subtitle identified in filename.

Post by rednoah »

:?: What does the MediaInfo Inspector say for the file at hand?

Image





walker63 wrote: 23 Dec 2022, 19:06 Is there anyway to look for both, and to have either ENGSUB or UNDSUB placed into the filename depending on which is found?
You can access raw MediaInfo properties via the {text} binding. I don't have sample files, so I don't know if your files are actually tagged with und or if the language property is missing entirely. The following sample code assumes the latter:

Code: Select all

{
	'en' in text.language ? '[ENGSUB]' :
	null in text.language ? '[UNDSUB]' : null
}


You'll probably want to cover all the corner cases. That might look like this:

Code: Select all

{
	any{
		'en' in text.language ? '[ENGSUB]' :
		null in text.language ? '[UNDSUB]' : '[SOMESUB]'
	}{
		'[NOSUB]'
	}
}
:idea: Please read the FAQ and How to Request Help.
walker63
Posts: 3
Joined: 23 Dec 2022, 18:20

Re: Embedded subtitle identified in filename.

Post by walker63 »

I just tested this under a few conditions...

Code: Select all

{n} ({y}) {" {tmdb-$id}"} { "{edition-${tags.first()}}" } - [{vf} {vc} {af} {ac}]{subt} { 'en' in text.language ? '[ENGSUB]' :null in text.language ? '[UNDSUB]' : null }
And it looks like it's going to work perfectly for me.

Because most of my media has external subtitles, I don't want to add the [NOSUB] marker to those movie filenames and instead only identify embedded subtitles.

I can't wait to test this out further.

Thank you so much and Merry Christmas!
Post Reply