Skip to content

Commit

Permalink
Various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Apr 1, 2019
1 parent 111b0f5 commit 5620288
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
13 changes: 4 additions & 9 deletions OpenSubtitlesDownload.py
Expand Up @@ -36,12 +36,12 @@
import os
import re
import sys
import time
import gzip
import struct
import argparse
import mimetypes
import subprocess
import argparse
import time
import gzip

if sys.version_info >= (3, 0):
import shutil
Expand Down Expand Up @@ -115,9 +115,6 @@
opt_selection_rating = 'off'
opt_selection_count = 'off'

# Enables extra output. Can be overridden at run time with '-v' argument.
opt_verbose = 'off'

# ==== Exit codes ==============================================================

# Exit code returned by the software. You can use them to improve scripting behaviours.
Expand All @@ -129,7 +126,6 @@
# priority: info, warning, error
# title: only for zenity messages
# message: full text, with tags and breaks (tag cleanup for terminal)
# verbose: is this message important?

def superPrint(priority, title, message):
"""Print messages through terminal, zenity or kdialog"""
Expand Down Expand Up @@ -450,7 +446,7 @@ def dependencyChecker():
else:
scriptPath = os.getcwd() + "/" + str(sys.argv[0])

# Setup parser
# Setup ArgumentParser
parser = argparse.ArgumentParser(prog='OpenSubtitlesDownload.py',
description='This software is designed to help you find and download subtitles for your favorite videos!',
formatter_class=argparse.RawTextHelpFormatter)
Expand All @@ -467,7 +463,6 @@ def dependencyChecker():

# Only use ArgumentParser if we have arguments...
if len(sys.argv) > 1:

result = parser.parse_args()

# Handle results
Expand Down
22 changes: 12 additions & 10 deletions README.md
Expand Up @@ -18,24 +18,25 @@ The subtitles search and download service is powered by [opensubtitles.org](http
Features
--------

- Use a GNOME/GTK or KDE/Qt GUI depending on your favorite desktop environment.
- Or just use the CLI! Great for automation, and it works on Linux, macOS and Windows.
- Use a GNOME/GTK or KDE/Qt GUI depending on your favorite desktop environment
- Or just use the CLI! Great for automation, and it works on Linux, macOS and Windows

- Query subtitles in more than 60 different languages for documentaries, movies, TV shows and more...
- Query subtitles in multiple languages at once.
- Query subtitles for multiple video files at once.
- Detect valid video files (using mime types and file extensions).
- Query subtitles in multiple languages at once
- Query subtitles for multiple video files and folders at once
- Detect valid video files (using mime types and file extensions)
- Detect correct video titles by computing unique movie hash sums in order to download the right subtitles for the right file!
- If the video detection fails, search by filename will be performed as backup method.
- If the video detection fails, a backup search using filename will be performed
- Download subtitles automatically if only one is available, choose the one you want otherwise.
- Rename downloaded subtitles to match source video file. Possibility to append the language code to the file name (ex: movie_en.srt).
- Rename downloaded subtitles to match source video file. Possibility to append a language code to the file name (ex: movie_en.srt).

Requirements
------------

- python (version 2 or 3)
- zenity (only for GNOME based desktop environments)
- kdialog (only for KDE based desktop environments)
- common unix tools: wget & gzip (GUI subtitles downloading), ps & grep (GUI autodetection)
- zenity (only needed for GNOME based desktop environments)
- kdialog (only needed for KDE based desktop environments)
- common unix tools (only needed for GUIs): wget & gzip (GUI subtitles downloading), ps & grep (GUI autodetection)

Installation
------------
Expand Down Expand Up @@ -71,6 +72,7 @@ Contributors
------------

- Emeric Grange <emeric.grange@gmail.com> maintainer
- Thiago Alvarenga Lechuga <thiagoalz@gmail.com> for his work on the 'Windows CLI' and the 'folder search'
- jeroenvdw for his work on the 'subtitles automatic selection' and the 'search by filename'
- Gui13 for his work on the arguments parsing
- Tomáš Hnyk <tomashnyk@gmail.com> for his work on the 'multiple language' feature
Expand Down
2 changes: 0 additions & 2 deletions desktop-files/OpenSubtitlesDownload-gnome.desktop
Expand Up @@ -8,9 +8,7 @@ Categories=AudioVideo;

Name=OpenSubtitlesDownload
GenericName=Automatic subtitles downloader
GenericName[fr]=Téléchargeur automatique de sous-titres
Comment=Download subtitles from opensubtitles.org
Comment[fr]=Télécharge des sous-titres depuis opensubtitles.org

OnlyShowIn=GNOME;LXDE;Unity;XFCE;
Exec=OpenSubtitlesDownload.py --gui=gnome "%F"
2 changes: 0 additions & 2 deletions desktop-files/OpenSubtitlesDownload-kde.desktop
Expand Up @@ -9,9 +9,7 @@ ServiceTypes=KonqPopupMenu/Plugin,video/*

Name=OpenSubtitlesDownload
GenericName=Automatic subtitles downloader
GenericName[fr]=Téléchargeur automatique de sous-titres
Comment=Download subtitles from opensubtitles.org
Comment[fr]=Télécharge des sous-titres depuis opensubtitles.org

OnlyShowIn=KDE;MATE;Razor;TDE;
Exec=openSubtitlesDownload.py --gui=kde "%F"

0 comments on commit 5620288

Please sign in to comment.