Sunday 25 August 2013

Python Application To Download Movie Subtitles

It is my first project and you know I haven't started it as a project, like I never thought that I will upload it to PyPI (Python Package Index). I have written it cause I was kind of bored downloading movie subtitles manually and the main reason was I like CLI I mean I use terminal a lot, a lot so needed an application that can do it for me. Then pysub-dl came to my mind and i wrote it. On the first version it was buggy but useful for me enough then I thought I should make it more stable that other people can use it cause there are many folks like me (kinda lazy). By the way, I forgot to tell that I first googled for a ready-made script but i couldn't find it so the situation drove me to this :p (Though there was some but I found them little complex and I like simplicity).
Now it is a program that one can easily find it useful in his/her daily routine.
It's time for quick documentation.

Download package: here

1. How to install it?

Ans:  It is stable enough and light-weight application, so you can install it to your system. To install pysub-dl via pip:
$ sudo pip install pysub-dl 

or if you have already downloaded the .zip or .tar.gz then after extracting cd to the it and run it like:
$ sudo python setup.py install 

or if someone want to test it first on a virtual environment then he/she does not need su access.

2. The big question: How to use it?

Ans: First answer is: One can do:

$ pysub-dl --help

It will show the usage. It shows something like:
usage: pysub-dl [-h] movie language

Searches and downloads subtitle for your movie

positional arguments:
  movie       Name of the movie
  language    Subtitle language

optional arguments:
  -h, --help  show this help message and exit

It is quite simple! huh! Now some example will clarify all the questions that I think.

3. Examples 

$ pysub-dl despicable-me-2 english

Like you can see the first argument is the movie name and the second in the language and one important thing that you should not use any spaces in the movie name, you should use '-' (hyphen) instead of ' '(white space). Now the output will show the available subtitles at subscene.com (Till now it supports onlu subscene.com) like:

List of subtitles available at subscene.com
1. Language: English
Despicable.Me.2.2013.TS.XviD.Feel-Free
2. Language: English
Despicable.Me.2.2013.TS.XviD.Feel-Free
3. Language: English
Despicable.Me.2.2013.TS.x264.AC3-BadMeetsEvil
4. Language: English
Despicable.Me.2.2013.720p.TS + END SCENE XViD - JUSTiCE
5. Language: English
Despicable Me 2 TS LiNE AC3 XViD-sC0rp
6. Language: English
Despicable Me 2 2013 HDCAM READNFO x264 AAC-BadMeetsEvil
7. Language: English
Despicable Me 2 2013 720p TS+ END SCENE XViD - JUSTiCE
Enter the number respective to download subtitle: 

You should put the index number corresponding to the subtitle like if I put 3 it will create a file named subtitle.zip in the present working directory which will contain the 3rd subtitle of the list.

Enter the number respective to download subtitle: 3
Was that appropriate? no

If you do not like it you can say 'n' or 'no' or 'nope' or 'nah', It will give you a chance to download another one:

Choose another one subtitle
Enter the number respective to download subtitle: 7

If you liked it just say 'yes' or 'y' or 'yeah' whatever:

Was that appropriate? yeah
Cool. Enjoy the movie!

It was so simple!