Coder Social home page Coder Social logo

emericg / opensubtitlesdownload Goto Github PK

View Code? Open in Web Editor NEW
580.0 14.0 63.0 283 KB

Automatically find and download the right subtitles for your favorite videos!

Home Page: https://emeric.io/OpenSubtitlesDownload

License: GNU General Public License v3.0

Python 99.66% Batchfile 0.34%
nautilus nautilus-extension download-subtitles subtitle-downloader opensubtitles

opensubtitlesdownload's Introduction

OpenSubtitlesDownload.py

GitHub release GitHub contributors GitHub issues License: GPL v3

Introduction

OpenSubtitlesDownload.py is a small software written in Python, built to help you quickly find and download subtitles for your favorite videos. It can be used as a nautilus script, or as a regular application working under GNOME or KDE desktop environments. You can also use it in full CLI mode (Command Line Interface) on your NAS, Raspberry Pi or anywhere you want really, as long as you have a working Python interpreter.

The subtitles search is done by precisely identifying your video files by computing unique movie hash sums. This way, you have more chance to find a subtitles that is an exact match for your video files, avoiding synchronization problems between the subtitles and the soundtrack. But what if that doesn't work? Well, a search with the filename will be performed, but be aware: results are a bit more... unpredictable (don't worry, you will be warned! and you can even disable this feature if you want).

The subtitles search and download service is powered by opensubtitles.com. Big thanks to their hard work on this amazing project! Be sure to give them your support if you appreciate the service provided, they sure need donations for handling the ever growing hosting costs!

OpenSubtitlesDownload v6 use the new REST API from the opensubtitles.com website

A valid account from opensubtitles.com is still REQUIRED

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
  • 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 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, a backup search using filename is performed
  • Download subtitles automatically if only one is available, choose the one you want otherwise
  • Download the subtitles file right next to the video file (need read/write permissions)
  • Rename downloaded subtitles to match the video file. Possibility to add a language code (ex: movie_en.srt).

Installation

Requirements

  • Python 3
  • zenity (only needed for GNOME based desktop environments)
  • kdialog (only needed for KDE based desktop environments)
  • Common unix tools (only needed for GUIs): wget, ps & grep (GUI autodetection)

Quick installation (nautilus script, with GNOME desktop environment)

For more installation options, check the wiki!

$ mkdir -p ~/.local/share/nautilus/scripts/
$ cd ~/.local/share/nautilus/scripts/
$ wget https://raw.githubusercontent.com/emericg/OpenSubtitlesDownload/master/OpenSubtitlesDownload.py
$ chmod u+x OpenSubtitlesDownload.py

IMPORTANT STEP: use an opensubtitles.com account!

To use OpenSubtitlesDownload you need to:

The old opensubtitles.ORG accounts won't work anymore (unless you migrated them from the new website).

Screenshots!

Start the search with a simple right click on a video file. Start subtitles search

If multiple subtitles are available, choose the one you want from the list! Multiple subtitles selection

The download will only take a moment. Download selected subtitles

Enjoy your subtitled video! Enjoy your subtitled video!

Website

You can browse the project website at https://emeric.io/OpenSubtitlesDownload
You can browse the project GitHub page at https://github.com/emericg/OpenSubtitlesDownload
Learn more about OpenSubtitlesDownload.py installation and configuration on the wiki at https://github.com/emericg/OpenSubtitlesDownload/wiki

Contributors

Get involved

Users

You can help us find and report bugs, propose new features, help with the documentation and more! Visit the Issues section to start!

Developers

You can browse the code on the GitHub page, submit patches and pull requests! Your help would be greatly appreciated ;-)

License

OpenSubtitlesDownload.py is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Read the LICENSE file or consult the license on the FSF website directly.

Emeric Grange [email protected]

opensubtitlesdownload's People

Contributors

agodard-witekio avatar amitgolden avatar d0ned0ne avatar darkdread avatar emericg avatar felagund avatar glensc avatar gui13 avatar jeroenvdw avatar kevcui avatar louietyj avatar morikko avatar pedrinho avatar thiagoalz avatar tony4dev avatar youremysoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensubtitlesdownload's Issues

SSL cert validation fails on macos

I'm on macos High Sierra and suddenly OSD stopped working giving me the ">> Unable to reach opensubtitles.org servers!" error. After a bit of debugging, I noticed that for some reason, it stopped accepting valid SSL certs, so I had to disable them globally by adding this:

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

Obviously, this is an issue with my macos and the python installation and not with the script. I'm creating the task just in case, someone else has the same issues as me

Can't connect to opensubtitles servers

Since a month I have issue that I can't download any subtitles, each time I get error message that "Unable to reach opensubtitles.org servers!", I can normally download the subtitles using the browser.
Also this app worked 2 months ago. What happened?

issue.

I believe i've found an issue.

When running 'OpenSubtitlesDownload.py -l dan,swe,eng foo.avi'(or 'OpenSubtitlesDownload.py -l dan foo.avi' - btw, I believe the -a switch don't have any effect when running from the CLI, so I omit it), then a danish sub is downloaded, which doesn't match the file(sub is for ep2 but file is ep1). I then thought it was because of the filename searching heuristics which obviously cannot be foolproof always, but then I renamed the file from it's original filename, to instead 'test.avi' and ran the exact same line, and then the correct sub was downloaded in danish. So a sub is available with matching hash, but for some reason a filename-search is done instead. I also tried disabling filename-matching completely and ran again but with same issue.

I've tried this with three different files now(out of 15 or so), where renaming the file away from it's original name, so forcing the hash-check to work, fixed it.

If you could please kindly test with one of my files when you have the time, then I would much appreciate it, thanks.

[FILE]

Unrelated, but sometimes the app fails to connect and shows an error, and then when run a second time it works, or sometimes a third time is needed. Of course this is due to server-overload, but as it fails already after 1 second or so, then I was thinking if it possibly could be extended to retry the connection for a bit longer, or track that it error'ed out and retry automatically? It's not a big deal when running manually, but when having it set to run like me automatically after every torrent download, then it's more an issue there(as I don't know if a missing sub means no subs available or a server-overload). Well, I guess I could in my postproc.sh script check for error-code, if provided, and set to call the app again in those occasions, and once more for the few times, it takes 3 runs to connect... Anyway, just a thought when i'm reporting to you anyway :)

-Martin.

Exit codes

It would be nice to have different than 0 exit code if none subtitles were found.

-i, --skip never work

Hi
Since the opt_language_suffix variable is set to auto, the skip option never works because the downloaded subtitle file name does not match the media file name since it has the language code appended to its name.

I changes the opt_language_suffix variable to off and the skip command works fine.

Thanks

Cloudflare DDos protection breaks application?

It seems I can no longer download subtitles. And I think it is because
OpenSubtitles has added Cloudflare DDos protection

This makes OpenSubtitlesDownload respond with

Unable to reach opensubtitles.org servers!

false positives...

I've encountered some false positives lately...

for example

./OpenSubtitlesDownload.py "The Pale Door 2020 WEBDL-1080p.mkv"

Downloading 'Dutch' subtitles for '"Vikings" Death and the Serpent'

./OpenSubtitlesDownload.py "Last Shot 2020 WEBDL-1080p.mkv"

Downloading 'Dutch' subtitles for '"The Resident" Last Shot'

opt_search_mode = 'hash_then_filename'

opt_selection_mode = 'auto'

type 'exceptions.UnicodeDecodeError'

~/.local/share/nemo/scripts/OpenSubtitlesDownload.py ~/Videos/Guardians.2017.1080p.BluRay.x264.mkv 
Unexpected error (line 786): <type 'exceptions.UnicodeDecodeError'>

Returns a long list if --cli is used. Something in the result list triggers the error for gnome gui result display.

System: Linux Mint 19.3

Unexpected error (line 768): <class 'AttributeError'>

Since the latest git version I run into this error:

% subtitledownload Some.Movie.20xx.ip.XviD.AC3-EVO.avi
Unknown GUI, falling back to an automatic CLI mode
Unexpected error (line 768): <class 'AttributeError'>

Request for sorting multiple languages in most to least preferred.

First, thanks for this awesome script, I love it, and other implementations always takes a bunch of other deps to work.

Now, my "issue" is that I want to retrieve subs in my native language, and if not available, then in english. I also use the script from my own shell-script set to run after each finished torrent download, so need automated behavior. I initially thought I could just use '-a -l dan,swe,eng', but this will take the best match, meaning highest rank. Highest rank is of course fine, but when there are a sub in my native language, then I rather want that sub, instead of an english sub with higher rank. My point is that I define the languages in the order of most to least preferred and not just randomly.

I would love if there could be an option for when selecting multiple languages, then the firstly mentioned one should take precedence irregardless of ranks.

To workaround this, then I have the script running 3 times now for every file, one on the least favored language, and second run in next favored and last in most favored language, and the subs are overwritten by default in your script, so this works fine, though not very efficient.

Hope I am making myself clear on what I mean here :) Thanks for your work regardless of the outcome of this request!

-Martin.

Bug in -l option when used multiple times.

I found a bug, which is that this line:

OpenSubtitlesDownload.py -a -l eng -l swe -l dan foo.mp4

Downloads only the sub in english, though there is also a swedish sub available but not gotten(the -a isn't the issue, it's the same without).

If moving the english language last, then it works and I get both swedish and english subs downloaded(there's no danish sub available for example file)

OpenSubtitlesDownload.py -a -l dan -l swe -l eng foo.mp4

This is an issue for me, because I set OpenSubtitlesDownload to not add country name to subs and then wanted to use the first line at top for getting first english subs and if swedish was available, then overwrite with that, and finally if danish(my native language) is available, then overwrite with that, since I only want one sub named after the video, and in that order of availability.

Let me know if you want the file to test or anything else. Thanks in advance.

Proposal for a new funcionality

Hello,

I would like to provide you some feedback along with a proposal for a new function.
First of all, its the first script after a long period which i can use it on my raspberry pi!

Now, what i would like to propose is a new functionality regarding the downloading of the same file. From my side, this script is being triggered automatically every time where a new movie is downloaded on a specific folder. Some times the subtitles are not available the time where the movie is available on my raspberry. So, i have to re-trigger it automatically (via crontab) again every night in order to find the subtitles.
The issue is that, there is no exit code or alternative function in case of the subtitles are already available on this folder, as a result the script downloads the same files every night.

I don't know if someone has another solution for my case (which can be scripted through SHELL SCRIPT) or he/she can modify the python script in order to check that there are already subtitles available, or maybe to provide a different exit code in order to catch it (the exit code i mean) via the Unix script.

Looking forward to your feedback,

-u and -p are not honored or working

When I edit the python file and add my credentials it does work but calling the cli to a folder gives an error
currently, on Python 3.8.6

C:\GitHub\OpenSubtitlesDownload>python OpenSubtitlesDownload.py --cli -l eng -l dut -a -x -u username -p password "C:\Temp\TV\A Very English Scandal\Season 01"
>> OpenSubtitles.org servers refused the connection: 401 Unauthorized.
- You MUST use a valid OpenSubtitles.org account!
- Check out <a href="https://github.com/emericg/OpenSubtitlesDownload/wiki/Log-in-with-a-registered-user">how and why</a> here
Unexpected error (line 825): <class 'AttributeError'>

C:\GitHub\OpenSubtitlesDownload>>> OpenSubtitles.org servers refused the connection: 401 Unauthorized.
- You MUST use a valid OpenSubtitles.org account!
- Check out <a href="https://github.com/emericg/OpenSubtitlesDownload/wiki/Log-in-with-a-registered-user">how and why</a> here

After editing the python file

C:\GitHub\OpenSubtitlesDownload>python OpenSubtitlesDownload.py --cli -l eng -l dut -a -x "C:\Temp\TV\A Very English Scandal\Season 01"
>> Downloading 'English' subtitles for '"A Very English Scandal" Episode #1.2'
Unexpected error (line 825): <class 'AttributeError'>

C:\GitHub\OpenSubtitlesDownload>Unexpected error (line 825): <class 'AttributeError'>
>> Downloading 'English' subtitles for '"A Very English Scandal" Episode #1.3'
Unexpected error (line 825): <class 'AttributeError'>

C:\GitHub\OpenSubtitlesDownload>

I end up with these.

A Very English Scandal - S01E01 - [1080p WEB-DL h264][NTG].mkv
A Very English Scandal - S01E02 - [1080p WEB-DL h264][NTG].mkv
A Very English Scandal - S01E02 - [1080p WEB-DL h264][NTG].srt
A Very English Scandal - S01E03 - [1080p WEB-DL h264][NTG].mkv
A Very English Scandal - S01E03 - [1080p WEB-DL h264][NTG].srt

Failure after downloading a number of subtitles

error is:
gzip: stdin: not in gzip format
Cannot write to '-' (Broken pipe).

I changed gunzip to gunzip -f
and found that the file it downloaded is "you are not logged-in.
Sorry, maximum download count for IP: xxxx to download"

suggestion : downloading subtitles for movies within a directory recursively

thank you for the amazing software. I would like to ask for a new feature .
the script takes ( file name/s ) as input in the same directory. i know it is possible for the feature im requesting to be done with some bash scripting but if it built-in would much easier to use.
is it possible to add -d (directory path ) argument to the options so
the script will look for movies within the directory and sub-directories .
i think the feature will be very handy for any one with big movies collection with lots of folders and sub-folders.

Thank you

manual search downloading incorrect subtitle if there is only one option

i use OpenSubtitlesDownload in cli mode only.

If i have search set to manual, fallback to search by name on and there is only one subtitle available it will be download regardless if it is the correct one or not.

If i have manual search set i believe the fallback should ask me if i want to download that subtitle even if there is only one as I want to review if it is the correct sub for my file first.

opensubtitles.org blocks some downloads when using a VPN

Doesn't matter if I download single file or whole directory, lot of subtitle files end up empty (not all).
e.g.
OpenSubtitlesDownload.py -u ****** -p ***** "Agents of SHIELD S02E11 Aftershocks.mp4"

but if I search with VLsub (tool in VLC) it finds and downloads them correctly.

I found out that when I force cli mode, i get this

>> OpenSubtitlesDownload encountered an unknown error, sorry about that...
Error: [type 'exceptions.IOError']
Line: 856

running with python3 gets me this:

>> OpenSubtitlesDownload encountered an unknown error, sorry about that...
Error: [class 'urllib.error.HTTPError']
Line: 846

What more details can I give you to find out what is happening?
Thank you

CLI documentation

Can you update the readme with the commands? I'm using this software on Windows as a command-line application.

Mac?

Can this be used in Mac?

Desktop files not working

When launching OpenSubtitlesDownload by right clicking on the video file in nautilus and selecting Open with other application->OpenSubtitlesDownload, it fails due to quotation marks in the OpenSubtitlesDownload-gnome.desktop exec line, removing them solves the issue.

missing options for login

these is no option for changing the username and password to login to the website.

here is my simple fix if you found it useful

after line 504:
parser.add_argument('-u', '--username', help="Set opensubtitles.org username") parser.add_argument('-p', '--password', help="Set opensubtitles.org password")

after line 535:
if result.username: if result.password: osd_username = result.username osd_password = result.password

link mdi-maximize-focused hasn't been detected!

Why am I getting these messages? The program worked a couple weeks ago.
I've updated to the latest version. Same.

Some system info if that helps:
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2 Kernel: 4.15.0-43-generic

./OpenSubtitlesDownload.py ../Galapagos.With.David.Attenborough.2013.1080p.BluRay.x264/*
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
Unknown option 'text'.
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
Unknown option 'text'.
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
qt.svg: link mdi-maximize-focused hasn't been detected!
qt.svg: link mdi-minimize-focused hasn't been detected!
Unknown option 'text'.

--auto switch

There are also some problems with --auto switch – first, it doesn't seem to work (besides, for some reason it also suggests S04E02 as one of the possibilities – even though it has detected the number of the episode correctly):

097115 on Talisker @ ~/Downloads> subs --auto Downton.Abbey.2013.Christmas.Special.HDTV.x264-FoV.mp4

>> Title: "Downton Abbey" Episode #4.9
>> Filename: Downton.Abbey.2013.Christmas.Special.HDTV.x264-FoV.mp4
>> Available subtitles:
[1] "Downton.Abbey.S04E09.HDTV.x264-FoV.srt" > "HI"
[2] "Downton Abbey S04E02 HDTV x264 FoV.Hi.srt" > "HI"
[0] Cancel search
>> Enter your choice (0-2): 0
Cancelling search...

and if I change opt_selection_mode in the script itself to manual, then it just downloads the wrong episode:

097115 on Talisker @ ~/Downloads> subs Downton.Abbey.2013.Christmas.Special.HDTV.x264-FoV.mp4
>> Downloading 'English' subtitles for '"Downton Abbey" Episode #4.3'
2014-01-12 08:33:27 URL:http://dl.opensubtitles.org/en/download/filead/src-api/vrf-49a6de9dd0/1953752720.gz [21783/21783] -> "-" [1]

(subs is my alias for the script; and that seems to be the file in question).

Handle CLI usage

Can't use without zenity, too bad!
Could you try enabling a CLI usage, without any dependency to visual windows?

opensubtitles.org API available only for logged users

Here is a communication from opensubtitles.org

API REQUESTS MUST BE AUTHENTICATED

With Covid-19 pandemic requests for our API went skyrocket, our servers could not handle so much traffic, so we decided to limit API usage just to authenticated requests for User Agents. In short it means, you have to provide opensubtitles.org username and password in LogIn() method.

We are avare some of user agents doesn't implement authentication for numerous reasons.

What you can do for fix, if your app is affected:
- let your users know about this change
- implement LogIn() into your app with user authentication
- contact us for pricing, so your app can send unathenticated requests (e.g. if you have free and pro version of your app, it is possible free will work only with authenticated requests and pro works as before)

More info on [our forum](https://forum.opensubtitles.org/viewtopic.php?f=11&t=17110)

We are actively blocking IPs, which are sending unathenticated requests

Following a recent policy change from opensubtitles.org, the API is now available only for logged users.
To continue using applications like OpenSubtitlesDownload you simply need to:

Updated
Now as far as I can tell, most users are experiencing these 401 errors, if not every users.
Maybe this limitation triggers only for softwares with high volume of requests, for instance I cannot use kodi embedded subtitles downloader without using an account, but I've been using OpenSubtitlesDownload without account from the same IP.

So let's use this thread to discuss issues with using accounts.
Let me know if you've had success with OpenSubtitlesDownload without using an user account, or if you needed to set one up!

Regular films

While it seems to work quite stable for the TV series, it somehow fails if trying to download subs for the regular feature films:

097115 on Talisker @ ~/Downloads> subs The\ Door\ In\ The\ Floor.mkv 
>> No subtitles found for this video:
The Door In The Floor.mkv

even though the subtitles in question, of course, do exist (subs is my alias for the script).

Error with Python 2.7

Hello i'm getting this error

('Unexpected error:', "<type 'exceptions.AttributeError'>")

on Debian with Python2.7.13.

Everything works fine with python3.5.3

I'm calling OpenSubtitlesDownload from a CLI script (bash). I could also insert a check to run it only if python3 is installed but maybe is useful for You to understand the issue.
Thanks!
Maurizio

Issue for multiple downloads when opt_search_overwrite == 'off'

In the following code block, for every call to videoPathList.remove(videoPathDispatch), an item in videoPathList will be skipped (removing elements while iterating).

# Check if the subtitles exists videoPathList
if opt_search_overwrite == 'off':
    for videoPathDispatch in videoPathList:
        if checkSubtitlesExists(videoPathDispatch) == True:
            videoPathList.remove(videoPathDispatch)

A simple solution would be to use a second array to hold the paths to remove later:

paths_to_remove = []

if opt_search_overwrite == 'off':
    for videoPathDispatch in videoPathList:
        if checkSubtitlesExists(videoPathDispatch) == True:
            paths_to_remove.append(videoPathDispatch)

for path_to_remove in paths_to_remove:
    videoPathList.remove(path_to_remove)

Hope it helps, keep up the good work!

Unhandled ProtocolError while downloading subtitles

Noticed the following in the logs while downloading a subtitle:

>> No subtitles found for this video:
E08. XXXIV. Jack and the Swamp Monster.mkv
Traceback (most recent call last):
  File "/usr/local/bin/OpenSubtitlesDownload.py", line 701, in <module>
    if session['token']: osd_server.LogOut(session['token'])
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1331, in single_request
    response.msg,
xmlrpclib.ProtocolError: <ProtocolError for api.opensubtitles.org/xml-rpc: 503 Backend fetch failed>

I believe this is because of a OpenSubtitles backend failure which I have noticed now and then from the browser as well. Can it be handled more gracefully?

Polish signs

script downloads subtitles without polish signs for example:

15
00:01:04,898 --> 00:01:09,278
To ja prowadzi³em nasz¹ organizacjê
przez 20 lat i troszczy³em siê o was.

UnicodeDecodeError: fix

Hi, I tried the last version 3.5 on Ubuntu Gnome 16.04 and it gave me this fatal error:

paulo@paulo-Aspire-5742 ~/.l/s/n/scripts> 
./OpenSubtitlesDownload.py "/mnt/Backup/Movies/The Great Gatsby (2013)/The.Great.Gatsby.2013.720p.BluRay.x264.YIFY.mp4"
Traceback (most recent call last):
  File "./OpenSubtitlesDownload.py", line 604, in <module>
    subtitlesSelected = selectionGnome(subtitlesList)
  File "./OpenSubtitlesDownload.py", line 225, in selectionGnome
    subtitlesItems += '"' + item['SubFileName'] + '" '
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 57: ordinal not in range(128)

So I found out that including these two lines on the beginning of the code just fix the problem:

reload(sys)  
sys.setdefaultencoding('utf8') 

Here's my modified version: http://pasteall.org/153473/python

Error: [class 'OSError'] - Manjaro + XFCE

Hi emericg ,

I just downloaded today's version of OpenSubtitlesDownload.py. This is the command line I ran and the msgs I've got:

$ ./OpenSubtitlesDownload.py --cli --auto '/mnt/hgfs/F_series_downloaded/movie.mkv'
>> Downloading 'English' subtitles for 'movie'
>> OpenSubtitlesDownload encountered an unknown error, sorry about that...
Error: [class 'OSError']
Line: 750
Just to be safe, please check:
- www.opensubtitles.org availability
- Your downloads limit (200 subtitles per 24h)
- Your Internet connection status
- That are using the latest version of this software ;-)
$ 

This was run on a Manjaro Linux VM, XFCE flavor, under VMWare Workstation on a Windows 7 host.
Not sure it matters here, but the .MKV file mentioned in the command sits within an NTFS file system, shared as read-only thru the "Shared Folders" feature of VMWare.

Am I doing anything wrong here ? Thx a lot for your help ! :)

Make the language suffix coherent with --lang argument

I'm not sure whether this is intentional or not, but the suffixed language appears to differ from the input language passed through --lang.

For example, if --lang fre is passed, the result suffix would be _fr. This makes the output srt hard to use in a script since the output filename of a given language code is non-deterministic. IMO, if --lang fre is passed as an argument, _fre should be the resulting suffix.

Otherwise, I have a couple other solutions to this problem :

  • Make opt_language_suffix configurable from the cli
  • Make the filename configurable from the cli. ATM, only the output directory is configurable, but not the filename if I'm not mistaken.

Thanks for the script!

Unable to change encoding from CP1250 to UTF-8

Unknown GUI, falling back to an automatic CLI mode

Downloading 'Serbian' subtitles for '"His Dark Materials" Armour'
OpenSubtitlesDownload encountered an unknown error, sorry about that...
Error: [class 'urllib.error.HTTPError']
Line: 831
Just to be safe, please check....

i wraped it with try except
and it gived mi then Error: [class 'NameError'] ...

so i printed subURL
https://dl.opensubtitles.org/en/download/subencoding-utf8/src-api/vrf-19e20c60/sid-rFCWEiFomr8tErX25XQnxKuH8B0/filead/1956564919.gz
in browser it shows [CRITICAL ERROR] Unable to change encoding from CP1250 to UTF-8 !
hmm so fast fix i just changed subencoding-utf8 to subencoding-utf and it now works kinda but ye you need to
wrap this up i guess :)

Specifying download location

Is it possible to specify where the output files go. I want too download subtitles for all my films but they are mounted through a read only drive so I cant write too there separate folders.

Feature request: Add subnuker functionality

Hi,

I've been using OpenSubtitlesDownload to automate sub downloading for my TV shows and it works really well!

As we are downloading the 'free' version of subtitles they have adverts in them.

I did some research on trying to remove these and I found subnuker. The default regexes of subnuker are dangerous - for example I watch a lot of ER and it attempts to remove subtitles containing "syncope" because it matches the regex for "sync".

Anyway, using the following command line:
subnuker --yes --file "$HOME/subnuker_pattern_file.txt" "$srt_file"
With the contents of:

[foo@BAR ~]$ cat subnuker_pattern_file.txt
OpenSubtitles

It perfectly cleans downloaded subs.

I think I will either investigate more subsytem or add some additional logic into OpenSubtitlesDownload to make a separate call to subnuker.

Interested in any thoughts / replies you might have!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.