Detect errors in video data writes
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sat, 17 Apr 2010 16:49:56 +0000 (18:49 +0200)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:27:01 +0000 (11:27 +0100)
youtube-dl

index d2bd0bf..86e2479 100755 (executable)
@@ -566,7 +566,10 @@ class FileDownloader(object):
                                except (OSError, IOError), err:
                                        self.trouble('ERROR: unable to open for writing: %s' % str(err))
                                        return False
-                       stream.write(data_block)
+                       try:
+                               stream.write(data_block)
+                       except (IOError, OSError), err:
+                               self.trouble('ERROR: unable to write data: %s' % str(err))
                        block_size = self.best_block_size(after - before, data_block_len)
 
                        # Progress message