aag / apple_trailer_downloader

A script to download HD trailers from the Apple Trailers website.
GNU General Public License v3.0
23 stars 5 forks source link

Handle timeouts gracefully #13

Closed forthrin closed 8 years ago

forthrin commented 8 years ago

The program should handle timeouts gracefully rather than doing a dumping the call stack.

Downloading Trailer: ***.Trailer.1080p.mov
  Saving file to ***/***.Trailer.1080p.mov
Traceback (most recent call last):
  File "bin/apple_trailer_downloader/download_trailers.py", line 506, in <module>
    settings['video_types']
  File "bin/apple_trailer_downloader/download_trailers.py", line 251, in downloadTrailersFromPage
    downloadTrailerFile(trailerUrl['url'], destdir, trailerFileName)
  File "bin/apple_trailer_downloader/download_trailers.py", line 237, in downloadTrailerFile
    shutil.copyfileobj(f, fp, chunkSize)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 49, in copyfileobj
    buf = fsrc.read(length)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 612, in read
    s = self.fp.read(amt)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
socket.error: [Errno 60] Operation timed out
aag commented 8 years ago

I'm not able to reproduce the timeout, but the newest version should handle them gracefully. Please give it a try and let me know if it didn't work.