[Sonarr AutoSubber v3] Cross platform automated multilingual subtitle downloading


#1

An automatic multilingual subtitle downloader using a custom script to run Filebot Subtitle Downloader


Description

Custom script for Sonarr for automated multilingual subtitle downloading.
This script uses Filebot to search for missing subtitles by hash in the given language(s) and
saves the file with ISO 639-2/B language code(s).
This handy for Plex users for instance, since Plex doesn’t support ISO 639-3 codes.

If multiple languages are required add them as a comma-separated list (without spaces!) eg. nl,en,fr,de


Prerequisites

  • Filebot
  • Filebot added to your system’s PATH (Environment Variable) setting
  • If you run Sonarr as a Windows service, DO NOT run it under the Local System account. Sonarr as a Windows service under the Local System Account doesn’t execute custom scripts. Run it as a user. Or you can run Sonarr as an application!
  • An Opensubtitles.org account to login to Opensubtitles in Filebot

Installation/Setup

  • Install Filebot. You can get it for free at https://www.filebot.net/. Donations are appreciated :slight_smile:
  • Copy sonarr-subber.groovy to your preferred location on your harddrive
  • In Sonarr navigate to Sonarr -> Settings -> Connect -> [+] -> Custom Script
  • In the Pop-up enter the following:
    Name: Enter a descriptive name to your liking eg. Sonarr Subtitle Downloader
    On Grab: No
    On Download: Yes
    On Upgrade: Yes
    On Rename: No
    Filter Series Tags: Use at your own discretion
    Path: Full path to Filebot. (On Windows systems: C:\Program Files\FileBot\filebot.exe)
    Arguments: -script “FULL-PATH-TO\sonarr-subber.groovy” --lang [2-letter ISO 639-1 language code(s)]
  • Click on the Test button.
  • If the test succeeded click on the Save button.

Arguments examples

In these examples it’s assumed you copied sonarr-subber.groovy to C:\MyScripts\ on a Windows system.

Search for Dutch subtitles:
-script “C:\MyScripts\sonarr-subber.groovy” --lang nl

Search for Dutch, English and French subtitles:
-script “C:\MyScripts\sonarr-subber.groovy” --lang nl,en,fr


This script also runs after manual imports.


The script

http://pastebin.com/Cma6Q8CB


[Sonarr AutoSubber v2] - PPS for multilingual automated subtitle downloading
[Sonarr AutoSubber v2] - PPS for multilingual automated subtitle downloading
Sonarr Movie Support Discussion & Planning
[Sonarr AutoSubber v2] - PPS for multilingual automated subtitle downloading
#2

*EDIT
It works, probably the first couple things i downloaded had no dutch subs.
My bad

Hiii!

it wont work at my pc, i think i have the right settings…

Installed Filebot -> with login to open subtitles

its in my env variable

Sonarr is running as a service, not local system account. my own user account

In sonarr custom script
on grab no
on download yes
on upgrade yes
on rename no
filter serie tags: i left it empty??
Path: C:\Program Files\FileBot\filebot.exe
Arg: -script “D:\Scripts\sonarr-subber.groovy” --lang nl there is the script…

What did i do wrong?


#3

Nice. I was looking for a way to do this using my own subtitle downloader (SolEol), for which I made a CLI version some time ago, and this script is a fantastic starting point.

It wouldn’t be a bad thing if something could be set to review missing subs after a while. Sonarr searches too early (for non-native languages subs usually take half a day or so to appear).

I’d rather not set a separate cronjob for this, but I’m not sure if there’s a way to use Sonarr to periodically (twice a day) search for missing subs.


#4

Glad it works :slight_smile:


#5

You could set a delay for downloading in Sonarr.

Go to: Settings -> Indexers -> Options -> Minimum Age.
Enter the number of minutes you want Sonarr to wait before downloading episodes.

One day has 1440 minutes, so do the math :slight_smile:

I have Sonarr to wait for a week, because Dutch subs usually take one to two weeks before surfacing.
After that a cronjob or scheduled job will still be necessary :frowning:

Glad you like it. Shouldn’t be to hard to port it to SolEol :slight_smile:


#7

I think I did get it to work with sonar on my synology device. But the problem is i see this error on the logs.
OpenSubtitles: Please enter your login details by calling filebot -script fn:configure
any help?


#8

Did you try running the command? You need to make a free account at OpenSubtitles. Then you need to tell Filebot the login credentials to enable it to find subtitles.

@Zignature Script works great! Do you know if there is any way to run it on already downloaded (existing) series? Thanks!


#9

You could run a batch file to do that.

I use the following script:

filebot -script fn:suball "E:\Media\Videos\TV Shows" --lang nl --output srt --encoding utf8 -non-strict
PAUSE

You need to change a couple of things to suit your setup:

  • change the path to the folder where you keep your files
  • change the language code if necessary
  • if you want an “exact” search delete the “-non-strict” part

I have saved this line of script in a cmd file e.g. getSubs.cmd on a Windows system.
The script will traverse the folder and will download any missing subtitle files if it can find any.

Make sure Filebot is added to your system’s PATH environment variable.


#10

It’ll skip existing subtitle files by the way


#11

Hi hamkaastosti,

Sorry for the ridiculously late response. I totally missed your message :blush:

You need to create a (free) account over at opensubtitles.org and subsequently enter those login details in Filebot.


#12

Thanks for the amazing script
I wish you make one for radarr :slight_smile:


#13

I think it should actually work for Radarr too :slight_smile:


#14

I am not a programer

But Is there any thing to change here

// select input video
def env = System.getenv()
def episodeFile = env[‘sonarr_episodefile_path’] as String

// fetch subtitles
def subtitleFiles = languages.findResults{
getSubtitles(lang: it, file: episodeFile, output: ‘srt’, encoding: ‘UTF-8’)


#15

Try changing sonarr_episodefile_path to radarr_moviefile_path


#16

Didn’t work
I got (No matching subtitles found: )
And i did search for the subtitle in opensubtitle and i find it there
I think its search for the subtitle in tv show !


#17

I’ll run some tests tomorrow and keep you posted.


#18

I will watch your post :wink:


#19

I just notice the same problem with sonarr !!
(No matching subtitles found: E:\TV Shows\The Middle\Season 4\The.Middle.S04E11.Life.Skills.DVD.mkv )
I am seraching for arabic subtitle
It was working then i just check some series and found no subtitle !!
But when i checked opensubtitles.com i did found the subtitles !


#20

Hi,

I cant do it :frowning_face:
Can anyone help me ?

How to check it ?
where I can find any log… ?