Thursday, October 22, 2015

Download Subtitles Via Nautilus / Nemo Context Menu With Periscope Or Subliminal

This article provides instructions for installing Periscope or Subliminal, two command line subtitle download tools, and how to add them to the Nautilus or Nemo context menu, so you can download subtitles with a simple click.

Some media players, such as SMPlayer for instance, come with built-in subtitle download support and for others you can install an extension to do this, like the VLSub VLC extension for instance.

But, most of these media players only use OpenSubtitles for downloading subtitles and, like any other website, OpenSubtitles can go offline at times. Also, using a single subtitle service limits the subtitle results.

For these reasons (well, and also because I use VLC 2.1 and VLSub doesn't work with it), I use the once popular Periscope Python tool to download subtitles. Because the Periscope PPA wasn't updated for a very long time (since Ubuntu 11.10), I uploaded the latest Periscope from Git to a PPA so if you need it, you can easily install it in recent Ubuntu versions.

Also, as Periscope wasn't updated in a while and I'm not sure if the project is still alive and for how long it's going to continue working, I also added Subliminal installation instructions to this article, including a Nautilus/Nemo script so you can download subtitles from the Nemo/Nautilus context menu via Subliminal.


Install and use Periscope in Ubuntu Or Linux Mint (Cinnamon) with Nautilus / Nemo or via command line


Periscope was once a pretty popular subtitle download tool for Linux. However, its developer isn't very active lately and its PPA wasn't updated for a long time. However, the tool still works well, or at least, it did in my test.

Periscope supports downloading subtitles from websites such as OpenSubtitles.org, Subscene.com, Addic7ed.com, Podnapisi and others.

Periscope can either be used via command line, or using Nautilus and Nemo extensions, which allow you to download subtitles from the Nautilus / Nemo context menu.

Periscope Nautilus extension

Periscope Nemo extension

1. Install Periscope in Ubuntu or Linux Mint

Important note: the failsdownloads Subtitle Utils PPA, used below, is not compatible with the ppa:nvbn-rm/ppa (because the nvbn-rm PPA doesn't use proper package names, they conflict with some packages from the Subtitle Utils failsdownloads PPA as well as with some packages from the Ubuntu 14.10 repositories) so if you use that PPA, either purge it or don't use the Subtitle Utils failsdownloads PPA.

To install Periscope in Ubuntu 12.04, 14.04, 14.10, 15.04 or 15.10 / Linux Mint 13, 17, 17.1 or 17.2 via PPA, use the following commands:
sudo add-apt-repository ppa:failsdownloadsteam/subtitle-utils
sudo apt-get update
sudo apt-get install python-periscope

2. Install Periscope Nautilus / Nemo extensions

To install the Periscope Nautilus extension and restart Nautilus (required for the extension to show in the the Nautilus context menu), use the commands below:
sudo apt-get install periscope-nautilus
nautilus -q

Or, to install the Periscope Nemo extension and restart Nemo (required for the extension to show in the Nemo context menu), use the following commands:
sudo apt-get install periscope-nemo
nemo -q
Important note for Nemo users: if you don't see a new item called "Find subtitles for this video" when right clicking a video file in Nemo, you may need to fix python-nemo as explained HERE (skip to step 4).

3. Configure Periscope

To be able to access the Periscope configuration file, either right click a video file in Nemo or Nautilus and select to download subtitles for it or download subtitles via command line (see below). After doing this, a configuration file called "config" should be created under ~/.config/periscope/, which should look like this:
[DEFAULT]
lang = en
lang-in-name = no
plugins =
Here you can set the default subtitle language (among other settings). So, to change the default subtitle language, open this file with a text editor - I'll use Gedit for the command below:
gedit ~/.config/periscope/config
... and change "lang" from "en" to the language you want to use for the subtitles downloaded using Periscope, then save the file.

To download subtitles using Periscope via command line, simply run:
periscope video.mp4
(where "video.mp4" is the video you want to download subtitles for).

Of course, you can pass the subtitle language directly via --language=LANG, etc. (but you need to change the configuration if you use the Nemo/Nautilus extension). To see all the available options, use:
periscope --help

To use it with Nemo / Nautilus, simply right click one or more video files and select "Find subtitles for this video", like you can see in the screenshots above.

If you encounter issues with Periscope, report them @ GitHub.


Install and use Subliminal in Ubuntu or Linux Mint (Cinnamon) with Nautilus / Nemo or via command line


Subliminal is a python library to search and download subtitles, which comes with a command line interface. It supports subtitle websites such as Addic7ed, OpenSubtitles, Podnapisi, TheSubDB and TvSubtitles.

Below you'll find instructions on installing Subliminal in Ubuntu or Linux Mint and how to add a Nemo / Nautilus script so you can easily download subtitles using Subliminal, from the Nemo / Nautilus context menu.

Subliminal Nautilus script

Subliminal Nemo script

1. To install Subliminal in Ubuntu or Linux Mint, we'll use PIP:
sudo apt-get install python-pip
sudo pip install subliminal

Using Subliminal from the command line is pretty easy: you need to specify the subtitle language using "-l" and the video file(s) for which it should download the subtitle. Here's an example on how to download subtitles for an episode from The Big Bang Theory (example via the Subliminal GitHub page):
subliminal -l en -- The.Big.Bang.Theory.S05E18.HDTV.x264-LOL.mp4
To see all the available options, use:
periscope --help

2. Install a Subliminal Nemo / Nautilus script

To be able to download subtitles using Subliminal from the Nemo or Nautilus context menu, use the commands below (note: the commands will download THIS Nemo / Nautilus script which I found HERE, but I modified it a bit so that it displays notifications):

- for Nautilus, Ubuntu 14.04 and newer:
sudo apt-get install wget libnotify-bin
mkdir -p ~/.local/share/nautilus/scripts
wget https://raw.githubusercontent.com/hotice/failsdownloads/master/download-subtitle -O ~/.local/share/nautilus/scripts/download-subtitle
chmod +x ~/.local/share/nautilus/scripts/download-subtitle
nautilus -q
- for Nautilus, Ubuntu 12.04:
sudo apt-get install wget libnotify-bin
mkdir -p ~/.gnome2/nautilus-scripts
wget https://raw.githubusercontent.com/hotice/failsdownloads/master/download-subtitle -O ~/.gnome2/nautilus-scripts/download-subtitle
chmod +x ~/.gnome2/nautilus-scripts/download-subtitle
nautilus -q
- For Nemo:
sudo apt-get install wget libnotify-bin
mkdir -p ~/.gnome2/nemo-scripts
wget https://raw.githubusercontent.com/hotice/failsdownloads/master/download-subtitle -O ~/.gnome2/nemo-scripts/download-subtitle
chmod +x ~/.gnome2/nemo-scripts/download-subtitle
nemo -q

3. To set the subtitle language used by the Subliminal Nautilus / Nemo script, open the file with a text editor, like Gedit:

- for Nautilus:, Ubuntu 14.04 and newer
gedit ~/.local/share/nautilus/scripts/download-subtitle
- for Nautilus, Ubuntu 12.04:
gedit ~/.gnome2/nemo-scripts/download-subtitle
- for Nemo:
gedit ~/.gnome2/nemo-scripts/download-subtitle
and change LANGUAGE="en" to the language you want to use, then save the file.

Then, to use the Subliminal Nemo / Nautilus scripts, right click on a video file (or multiple video files) and select  Scripts > download-subtitle, as you can see in the screenshots above.

If you encounter issues with Subliminal, report them @ GitHub.

No comments:

Post a Comment