Page 1 of 1

Subtitle language detection and genre sorting

Posted: 31 Jan 2016, 21:21
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!

Re: Subtitle language detection and genre sorting

Posted: 31 Jan 2016, 22:00
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}/...

Re: Subtitle language detection and genre sorting

Posted: 04 Feb 2016, 21:30
by CzechMate
Thank you very much, now it works fine and I managed to add the genre as well, excelent software!

Re: Subtitle language detection and genre sorting

Posted: 05 Feb 2016, 08:55
by rednoah
FYI the latest revision supports {lang} language detection again. ;)