A newer cross-platform version can be found here:
An automatic multilingual subtitle downloader using a custom script (Windows batch file) invoking Filebot Subtitle Downloader
Prerequisites:
- An Opensubtitles.org account
- Filebot
- Filebot in your system’s PATH (Environment Variable) setting
- Windows OS (it’s probably pretty easy to port to Mac or Linux)
- Run Sonarr as an application! NOT as a Windows Service! Sonarr as a service doesn’t seem to fire custom scripts.
What Does It Do?
After importing a downloaded episode the script invokes Filebot to search and download the correct subtitle file in SRT format. Your preferred language is added as an argument in Sonarr, using 2-letter ISO 639-1 language code eg. nl. For multiple languages add them as a comma-separated list (without spaces!) eg. nl,en,fr
Filebot searches by hash to ensure the correct subtitle is indeed downloaded. If it doesn’t find a subtitle, Filebot simply ends. The script also works with manual imports (Sonarr -> Wanted -> Manual Import).
Since Plex doesn’t support ISO 639-3 language codes, the script converts the ISO 639-3 codes to ISO 639-2/B codes.
The Batch File:
@ECHO OFF
@setlocal EnableDelayedExpansion
:: [Sonarr AutoSubber v2] by Zignature & rednoah
:: NOTES:
:: Filebot.exe needs to be in your system’s PATH (Environment Variable) setting!!!
:: Sonarr needs to run as an application. NOT as a Windows service!
:: Invoke Filebot to search for subtitle(s) by hash (strict mode).
START “Searching subtitle(s)…” /WAIT filebot -script “E:\Scripts\ISO639-2B-subber.groovy” “%sonarr_episodefile_path%” --lang %1
The Groovy Script
The engine of it all
http://pastebin.com/CYcUrBEK
How To Setup?
- Register an account at http://www.opensubtitles.org/
- Download (http://www.filebot.net/) and install Filebot (it’s a Java application, so it’s cross-platform!)
- Add filebot to your system’s PATH (Environment Variable) setting
- Copy the code for the batch file and save as sonarr-autosubber.bat
- Setup the custom script in Sonarr (Sonarr -> Settings -> Connect -> + -> Custom Script)
Single language:
Multiple languages:
5a. Name: Sonarr AutoSubber (or whatever you fancy)
5b. On Grab: No, On Download: Yes, On Upgrade: Yes, On Rename: No
5c. Path: C:\Windows\System32\cmd.exe
5d. Arguments: /C “C:\FULL-PATH-TO\autosubber.bat [2-letter ISO 639-1 language code(s)]” (In my case: /C “E:\Scripts\autosubber.bat nl”) - Save the custom script
A million thanks and kudos go out to rednoah for putting my concept to script!
Happy dowloading!