Rename and move Subtitles properly?

All about user-defined episode / movie format expressions
Post Reply
Elamania
Posts: 15
Joined: 07 Sep 2015, 23:00

Rename and move Subtitles properly?

Post by Elamania » 20 Jul 2018, 18:09

Hi, would like to know how I move all the Subs into an "Sub" Folder and then rename them according to the filename of the movie.
With the end of the Subname being the language or if it´s forced or not.
So that it gets automatically recognised by VLC&KODI.

Here is how I check for subs:

Code: Select all

{isSub={if(ext=~ /sub/ || ext=~ /idx/ || ext=~ /srt/ || ext=~ /ssa/ || ext=~ /sup/|| ext=~/ass/) return true;};null}
...
{isSub() ? "Subs/" : null} 
and here for the language:

Code: Select all

{String result=""; String e=""; String g=""; String f=""; extracted=fn.substring(fn.length()-17,fn.length());  if(isSub()){  if(extracted.toLowerCase().contains("ger") || extracted.toLowerCase().contains("de")) g="-GERMAN";  if(extracted.toLowerCase().contains("eng") ) e="-ENGLISH";  if(extracted.toLowerCase().contains("forced")) f="-FORCED";result=g+e+f; }}{result}
https://imgur.com/a/yFc027g

Why are the last two not properly recognised and is there an way to simplify my language detection in the subfiles?

User avatar
rednoah
The Source
Posts: 14678
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename and move Subtitles properly?

Post by rednoah » 20 Jul 2018, 19:48

A simple example might look like this:

Code: Select all

{plex.dir}/{f.subtitle ? 'Subs' : null}/{plex.name}
:idea: Please read the FAQ and How to Request Help.

Elamania
Posts: 15
Joined: 07 Sep 2015, 23:00

Re: Rename and move Subtitles properly?

Post by Elamania » 20 Jul 2018, 20:09

Lol, well that is short.
Anyway how should I do it with using my naming scheme?
Especially I like that I would not have to build that annoying end part of the Sub.
And I have found that from short Subnames nothing is parsed. ie: 1080p-ger will not be recognised, any idea?

Besides this one has the problem that it adds an CDx to some subs.

User avatar
rednoah
The Source
Posts: 14678
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename and move Subtitles properly?

Post by rednoah » 20 Jul 2018, 20:35

What you're asking for might be possible, but it's gonna be overly complicated and difficult to understand or maintain. If something is not working as expected, best to included samples or screenshots to illustrate the problem.

1.
*.ger.sub files will be recognized as German, based on the filename.

2.
You can use {ny} and {subt} if {plex.name} works against you with including CD numbers. You might also need to match custom patterns from the original filename via String.match(...) to ensure unique output paths when movie / language / extension is the same for multiple files.
:idea: Please read the FAQ and How to Request Help.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests