emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
581 stars 63 forks source link

Unhandled ProtocolError while downloading subtitles #29

Closed jarun closed 6 years ago

jarun commented 6 years ago

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?

emericg commented 6 years ago

Hi, Sorry for the delay, this should now be fixed with latest commit (08aa0b2).

Unhandled exceptions like this one from xmlrpclib will just prompt a single CLI error message. I did not added the xmlrpclib.ProtocolError in the regular error handler because it's not the same exception in python 2 or 3, and kind of annoying to handle properly :(