Audio language missing in file, adds null to file name

All about user-defined episode / movie / file name format expressions
Post Reply
User avatar
Spaztrick
Posts: 4
Joined: 13 Feb 2024, 02:13

Audio language missing in file, adds null to file name

Post by Spaztrick »

Just updated to 5.1.2 on Windows 10 and the format/preset I've been using now results in a slightly different file name than previously. Just trying to get back to [null] not being added to the file name if the audio language is blank. Any ideas?

My source file starts as this:
The.Example/The.Example:Confused.2024.1080p.BluRay.Dual.Uncut.DTS.x264-scene_name.mkv

If the audio tracks lacked language information, it would previously result in:
Example։ Confused, The (2024) [1080p]/The Example։ Confused (2024) [1080p.BluRay.x264.6ch.DTS] {edition-Uncut}.mkv

Now the same file results in:
Example։ Confused, The (2024) [1080p]/The Example։ Confused (2024) [1080p.BluRay.x264.6ch.DTS.[null, null]] {edition-Uncut}.mkv

Code: Select all

{ n.replaceFirst(/^(?i)(the)\s(.+)/, /$2, $1/)colon('։ ') } ({y}) [{vf}]/{n.colon('։ ')}{" ($y)"} [{vf}{'.'+source}{'.'+vc}{'.'+af}{'.'+ac}{'.'+audio.language}]{ " {edition-${tags[0]}}" }{' - pt'+pi}
*If the audio tracks have a language listed, it results in this:
Example։ Confused, The (2024) [1080p]/The Example։ Confused (2024) [1080p.BluRay.x264.6ch.DTS.[en, ja]] {edition-Uncut}.mkv
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audio language missing in file, adds null to file name

Post by rednoah »

e.g. the {audioLanguages} binding takes care of these things:

Format: Select all

{ '.' + audioLanguages.ISO2 }


You may prefer .en.ja in your format, unless the double nested [...] are on purpose:

Format: Select all

{ audioLanguages.ISO2.joining('.', '.', '') }
:arrow: Format {audioLanguages} to (DE, EN)
:idea: Please read the FAQ and How to Request Help.
User avatar
Spaztrick
Posts: 4
Joined: 13 Feb 2024, 02:13

Re: Audio language missing in file, adds null to file name

Post by Spaztrick »

I appreciate that. It worked for dropping "null" but now if there's more than one audio track in the same language, it just puts the language code once. Example, movie has 3 audio tracks... one in Japanese (movie dialog) and two in English (dubbed dialog & commentary), the result is [ja,en] instead of [ja,en,en].

Also noticed that Tagalog (tl or tgl) isn't being picked up at all with either version you posted.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audio language missing in file, adds null to file name

Post by rednoah »

Yes, that is the intended behavior of {audioLanguages}, deduplication, normalization, remove unknown / undefined language codes, etc.


:arrow: Looks like you need to access the raw audio stream properties after all, and then filter out the null values for your purposes:

Format: Select all

{ audio.language.findResults{ it } }
or

Format: Select all

{ audio.language.minus(null) }
:idea: Please read the FAQ and How to Request Help.
User avatar
Spaztrick
Posts: 4
Joined: 13 Feb 2024, 02:13

Re: Audio language missing in file, adds null to file name

Post by Spaztrick »

It's getting there!

Format: Select all

{ n.replaceFirst(/^(?i)(the)\s(.+)/, /$2, $1/)colon('։ ') } ({y}) [{vf}]/{n.colon('։ ')}{" ($y)"} [{vf}{'.'+source}{'.'+vc}{'.'+af}{'.'+ac}{ audio.language.minus(null) }]{ " {edition-${tags[0]}}" }{' - pt'+pi}
This finds the Tagalog language and also gives me the two letter code for every audio stream [ja, en, en]. But, it leaves [] if the language is missing. Guess I'll live with that (until my headache goes away).
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Audio language missing in file, adds null to file name

Post by rednoah »

e.g. .[en, en]

Format: Select all

{ audio.language.joining(', ', '.[', ']') }
e.g. .en.en

Format: Select all

{ audio.language.joining('.', '.', '') }

:arrow: Please read Format List of Values for details.
:idea: Please read the FAQ and How to Request Help.
User avatar
Spaztrick
Posts: 4
Joined: 13 Feb 2024, 02:13

Re: Audio language missing in file, adds null to file name

Post by Spaztrick »

Thanks for the help rednoah!
Post Reply