Linux, Deluge, Subliminal, Thunar and some nice subtitle tricks

I have this nice home server running Lubuntu 13.10, and it does a nice job managing downloads (Deluge + WebUI + TransDroid), serving files (Samba + Network Places), streaming analog TV (TVHeadend + TVHGuide), backing up my files and projects (BitTorrentSync), and handling all print jobs (CUPS + Let’s Print Droid) and some other tasks.

The only “discomfort” left were the Dutch subtitles for our movies and series. Before watching I had to go to my PC, log in to bierdopje.com or a similar site, search for the correct version and store it next to the .mkv on my network disk. No more!

I found out about a project especially for grabbing subtitles: Subliminal (previously Periscope).
Installation went wrong a couple of times, but once it worked it worked great. I’m not going to copy-paste the installation manual, you can find that here or here.

What I will post is what I did once Subliminal was installed. First of all, I wanted Deluge to get subtitles for every episode or movie once it was completed. Secondly, I wanted to be able to get a subtitle for videos that were already downloaded.

Subliminal Syntax

Once installed correctly, you can ask Subliminal to search for a subtitle with the following command:

subliminal -l en -- The.Big.Bang.Theory.S05E18.HDTV.x264-LOL.mp4

or in my case, Dutch:

subliminal -l nl -- The.Big.Bang.Theory.S05E18.HDTV.x264-LOL.mp4

Deluge Execute

The “Execute” plugin allows you to execute a command or script when a torrent is completed.
Deluge sends 3 parameters to you command or script: 1) the hash 2) the file name 3) the folder.
That’s cool, because subliminal needs the file name, and the folder name.

So I wrote a tiny little script to let the two communicate, and saved it as /home/server/getsubs.sh


#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3

cd $torrentpath
subliminal -l nl -- $torrentname

It’s a really simple script: go into the directory where the video is stored, and ask subliminal for a Dutch subtitle.

Made it executable: sudo chmod u+x /home/server/getsubs.sh

And told Deluge to run this script when a download is completed:

After enabling this plugin Deluge may require restarted for it to work properly.

I did, and it did! For every (most) movies and series a Dutch subtitle now magically appears next to the video file!

Thunar File Manager

Now the part where you can get a subtitle for previously downloaded videos. The subliminal script is in place, so now let’s find out how we can use this in Thunar.
Thunar allows you to make “custom commands”, and that is what we’ll do.

From the Thunar menu, choose “Edit” -> “Configure custom actions”
Click + (add a custom action) and fill it out like this:

The “command” line is: /home/server/getsubs.sh 000 %N %f (%N is the filename, %f is the folder)

Then on the second tab we fill in when this custom menu will appear:

And the end result is a quick right-click “Get Dutch subtitle” menu that instantly gets the best subtitle:

One thought on “Linux, Deluge, Subliminal, Thunar and some nice subtitle tricks

  1. High website you hold. Do you already consent Bitcoins? I would recommend to gesticulate up at who-accepts-bitcoins.com. They instrument create the reciprocation you require as their database is oftentimes searched by bitcoin spenders. It’s emancipated though!

Comments are closed.