2 Letter subs

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
unit
Posts: 5
Joined: 23 Apr 2014, 19:03

2 Letter subs

Post by unit »

Since the other programs I use prefer to use 2 letter sub extensions instead of 3 I decided to write a script for filebot which uses 2 letter extensions as well. Used the suball script as a basis and went from there. I have 0 experience in coding in Java/Groovy, thus someone with more experience could code it a lot neater. However as far as I have tested it does work.

Simply run the script using

Code: Select all

filebot -script /path/to/script /path/to/videos --def language=en maxAgeDays=10
You can omitt maxAgeDays if you want, you will have to specify a language. Only 1 language is permitted at a time though, so just run the script multiple times if you want multiple languages. The script will look for all video files, check if there are any subtitle files of the form: <filename>.<2letter lang code>.<.srt>, if there are none it will attempt to download them. As the downloaded sub will have the 3 letter extensions it then renames them using the same language code you put in. So for example <filename>.en.srt or <filename>.nl.srt.

Haven't tested this much yet, let me know if you run into any trouble:

https://www.dropbox.com/s/cywsawfxl20bn ... ter.script

//Edit: Added a message at the end informing you with the results.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Letter subs

Post by rednoah »

FileBot uses the standard, so should everybody else:
http://en.wikipedia.org/wiki/ISO_639-3

If you don't like it you can just do a search & replace on all your filenames:
http://www.filebot.net/forums/viewtopic ... &t=5#p2100
:idea: Please read the FAQ and How to Request Help.
unit
Posts: 5
Joined: 23 Apr 2014, 19:03

Re: 2 Letter subs

Post by unit »

Then it will look for subtitles again when I run the script again as it doesn't recognize the renamed .srt files. I do understand the reasoning behind using 3 letters instead of 2, but have too many programs that only support 2.

Not asking for you to implement something you don't want to, just coded something myself and providing it to whoever wants it. As I did find some topics about this when I searched the forums.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Letter subs

Post by rednoah »

FileBot_4.1_RC1 considers both 2- and 3-letter codes when checking for missing subtitles.

PS: Thanks for contributing your scripts. One of the firsts. :D
:idea: Please read the FAQ and How to Request Help.
unit
Posts: 5
Joined: 23 Apr 2014, 19:03

Re: 2 Letter subs

Post by unit »

rednoah wrote:FileBot_4.1_RC1 considers both 2- and 3-letter codes when checking for missing subtitles.

PS: Thanks for contributing your scripts. One of the firsts. :D
Lol, that makes basically all of my work obsolete. Ah well learned some stuff while doing it.
Post Reply