Subtitle language detection and genre sorting

All about user-defined episode / movie / file name format expressions
Post Reply
CzechMate
Posts: 10
Joined: 12 Dec 2015, 12:35

Subtitle language detection and genre sorting

Post by CzechMate »

Hi,

I know the language detection is no longer supported, but I tried your method:

Code: Select all

{if (ext == 'srt' && file.text.matchAll('the|a|an').size() > 100) '.eng' else '.deu'}
I used it like this:

Code: Select all

/Volumes/Public/Seriály/{n}/{'Season '+s}/{n} - {s00e00} - {t} {if (ext == 'srt' && file.text.matchAll('the|an').size() > 100) '.eng' else '.cze'}
And it does not work. It renames all files, including *.avi *.mp4 etc. So I must be doing something wrong, as I only want to add language code to srt files.


Also, I would like to separate the movies by genre by creating folders for comedies, thrillers etc...

Can you please help finding the correct syntax?

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

Re: Subtitle language detection and genre sorting

Post by rednoah »

1.
You want to only return a value for subtitle files:

Code: Select all

{if (ext == 'srt') file.text.matchAll('the|an').size() > 100 ? '.eng' : '.cze'}
For srt files the result will be either ".eng" or ".cze", but for non-srt files there will be no result.


2.
You'll want to use {genre} somewhere in your format.

Code: Select all

.../{genre}/{n}/...
:idea: Please read the FAQ and How to Request Help.
CzechMate
Posts: 10
Joined: 12 Dec 2015, 12:35

Re: Subtitle language detection and genre sorting

Post by CzechMate »

Thank you very much, now it works fine and I managed to add the genre as well, excelent software!
User avatar
rednoah
The Source
Posts: 23137
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Subtitle language detection and genre sorting

Post by rednoah »

FYI the latest revision supports {lang} language detection again. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply