Renaming Subtitles in Subfolder

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
dapersa
Posts: 8
Joined: 23 Jun 2017, 21:59

Renaming Subtitles in Subfolder

Post by dapersa »

Hi there!
I'm very new to scripts and automations. So far everything I did was via the UI which is easy for me.

I've got a couple of series with Folders containing each episode. Then in that episode-folder there is a "Subs" Folder containing Multiple Subtitle Files.
The Subtitles are .idx and .sub files, each in two languages. The English version has a "-eng" at the end. The German version doesn't have a different ending.

Any way to easily rename all episodes to "D:\Plex\Bibliotheken\Filme\Serien\{n} ({y})/{'Season '+s00}/{n} ({y}) - {s00e00} - {t}"
and the Subtitles also to "D:\Plex\Bibliotheken\Filme\Serien\{n} ({y})/{'Season '+s00}/{n} ({y}) - {s00e00} - {t}" with the english version keeping the suffix?

If that could be somehow done via the UI, I'd be very happy. I'm happy to learn it via Console of course, but I might not get it on the first try :oops: :D

Thanks a lot in advance!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming Subtitles in Subfolder

Post by rednoah »

1.
I think you can just follow the How do I organize files for Plex? guide. The current file structure doesn't really matter. You just need to modify the format to your needs:

Code: Select all

D:/Plex/Bibliotheken/{plex.id}


2.
If you just want to rewrite file paths offline with Plain File Mode, then there's a number of examples, and perhaps one of them already matches your use case:
viewtopic.php?t=12907
:idea: Please read the FAQ and How to Request Help.
dapersa
Posts: 8
Joined: 23 Jun 2017, 21:59

Re: Renaming Subtitles in Subfolder

Post by dapersa »

{plex.id}
Thank you very much @rednoah.
While this is actually what I've been searching for, I still happen to get one problem with this.

There are three versions mostly (German, English, English forced). It only renames them to two versions and it gets conflicts. See Examples here:

Image

And it renames to this:
Image

Resulting in this conflict:

Image

any way to get the "forced" extension at the end of the files just like the "eng" extension?

Thanks a lot!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming Subtitles in Subfolder

Post by rednoah »

FileBot cannot detect the {subt} subtitle language / tag if it cannot detect the language, so it'll only work if files are already somewhat well-named:

Code: Select all

.eng
.eng-forced


:arrow: The easiest solution is probably to adjust your custom format and match some information from the original file path and then use that to generate your target file path:

Code: Select all

{ fn.match('-forced') }
:arrow: [SNIPPET] Match information from the file path




:arrow: You may want to fix your subtitle naming while you're at it, i.e. no language means German language (?) and then propose file paths accordingly:

Code: Select all

{
	any{ subt }{ fn =~ /-forced/ ? '.deu.forced' : '.deu' }
}



EDIT:

FileBot r9669 and higher now allow modifier-only language tags such as ".forced" by default. This change is experimental and may not stick around depending on feedback.
:idea: Please read the FAQ and How to Request Help.
Post Reply