Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Subtidal, for batch downloading subtitles for all movies in a central media folder.

Project description

subtidal

GitHub python3

A command line utility for batch downloading subtitles for all movies organized in a central media folder.

Walks the file tree, visiting subfolders and downloading subtitles for each movie if they do not already exist.

Changes subtitle names so that they are automatically recognized by Roku Media Player, VLC, and others.

Makes quick work of central media folders and entire hard drives alike. Ideally, your central media folder will be organized as a repository of folders, with one movie or TV show each, but subtidal will still work if they're not quite that tidy.

Installation

Use the package manager pip to install subtidal. From the command line:

pip install subtidal

Quickstart

Option 1: From the command line

cd /path/to/Your-Movie-Folder
download-subtitles

or, call download-subtitles and specify the path directly:

download-subtitles /path/to/your-movie-folder

Option 2: From Python

from subtidal.download import download

download("./path/to/Your Movie Folder")

# you can also add optional parameters
download(directory="./path/to/Your Movie Folder", verbose=True)

subtidal-demo

Motivation

I hope this project is of use to you. I got frustrated (or rather, was very mildly inconvenienced) because some of the movies I downloaded online didn't come included with subtitles, and I often found myself having to pause the movie I was watching to manually download them from sites like opensubtitles.org](https://opensubtitles.org).

Furthermore, even when subtitles were included with a movie, if the filename differed at all from the name of the movie, they weren't recognized by the Roku Media Player, so I set about to rectify that.

I have a huge, network-attached-storage media folder that acts as the central repository for all of the movies I download online, and I wanted to create a package that could download missing subtitles for every movie in it in one fell swoop.

I imagined that as I downloaded new movies and TV shows into this central repository, I'd be able to run the package periodically via a cron job on my Raspberry Pi, so I'd never have to suffer the loathsome indignity of watching a show without having subtitles available ever again. This package is my attempt to make that vision a reality (or to make some fun out of laziness, depending on how you look at it), and in so doing, make a package available to the public on PyPI, which I had never done before.

Additional function & parameter info in the docstring

def download_subtitles(directory, verbose=False):
    """
    Takes in a directory path, walks through the file tree, and downloads subtitles for any video files found.
    Renames the subtitle file to match the video's name (in order to make it compatible with Roku Media Player.)

    :param (str) directory: Directory where video files or folders are located.
    :param (str) language : [optional] Desired language for subtitles, expressed as a 3-letter ISO-639-3 code. Visit https://bit.ly/29fjNpm for a list of language codes.
    :param (str) country : [optional] Country code (needed in addition to language code for certain languages).
    :param (bool) verbose : [optional] Prints more output to the console.

    Examples:
    1. download_subtitles('./Users/Laura/Movies')
    2. download_subtitles(directory='./Users/Tim/TV Shows', verbose=True)
    """

Contributing

Pull requests are welcome!

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for subtidal, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size subtidal-1.1.0-py3-none-any.whl (6.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size subtidal-1.1.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page