"Default" value for {subt} and {lang}

Any questions? Need some help?
Post Reply
inariel
Posts: 3
Joined: 19 Jul 2018, 14:06

"Default" value for {subt} and {lang}

Post by inariel »

Dear all,

it is my first post in this forum and after reading a lot of post, I'm disturbing you since I was not able to understand how to change a filbert behavior.
I have some tv series released as follow

TvSeries.S1.E01.Episode Name.mkv

With the following subtitles
TvSeries.S1.E01.Episode Name.srt
TvSeries.S1.E01.Episode Name.ita.srt
TvSeries.S1.E01.Episode Name.eng.srt

where the first one is the "ita.forced" subtitle. Since it has no tag for language FileBot detects it as a "eng" subtitle. Is there a way to change it forcing FileBot to detect as ita.force this kind of subtitles? I would avoid to have to rename it manually before the parsing... I'm running Filebot on my nas.
Thank you for any suggestion.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "Default" value for {subt} and {lang}

Post by rednoah »

Sure, something like this will do:

Code: Select all

{any{subt}{if (f.subtitle) '.ita-forced'}}
You can read up on how and why this works in the Naming Scheme stickies here in the forums.

This one is more tricky than usual because want a default value for subtitle files only, so there's an extra check there.
:idea: Please read the FAQ and How to Request Help.
inariel
Posts: 3
Joined: 19 Jul 2018, 14:06

Re: "Default" value for {subt} and {lang}

Post by inariel »

Thanks rednoah, I tried to change the format following your example but it doesn't seem to work. My educated guess is that FileBot returns eng as subtitle so the condition doesn't apply.
I tried with the sample under episode binding and I obtained lang=eng and subt=.eng for the .srt file with language tag.

I obtain the following result

Code: Select all

TvSeries.S1.E01.Episode Name.srt           --> TvSeries - S01E01 - Episode Name.eng.srt
TvSeries.S1.E01.Episode Name.ita.srt      --> TvSeries - S01E01 - Episode Name.ita.srt
TvSeries.S1.E01.Episode Name.eng.srt     --> TvSeries - S01E01 - Episode Name.eng.srt
using the following format

Code: Select all

{n} - {s00e00} - {t}{any{subt}{if (f.subtitle) '.ita-forced'}}
Thanks you again for your help.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "Default" value for {subt} and {lang}

Post by rednoah »

Good point. Instead of failing, language-auto detection kicks in, so subt is always defined. It's kinda strange that Italian subtitles would be misidentified as English though.

I guess you'll have to do it the other way around:

Code: Select all

{f.subtitle ? fn =~ /[.](eng|ita)$/ ? subt : '.ita.forced' : null}
:idea: Use subt if filename ends with .eng or .ita, and use .ita.forced otherwise for for subtitles, and just nothing for non-subtitle files.
:idea: Please read the FAQ and How to Request Help.
inariel
Posts: 3
Joined: 19 Jul 2018, 14:06

Re: "Default" value for {subt} and {lang}

Post by inariel »

Ok. This one works fine! I have to deeply investigate the syntax of this powerful language!
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "Default" value for {subt} and {lang}

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
Post Reply