aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/__init__.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2011-12-16 23:28:43 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2011-12-16 23:33:46 +0100
commita5647b79ce9295faa5278b015ac98e91f371207d (patch)
tree7e929ab4454e7ffe45e71ae654482b2549841794 /youtube_dl/__init__.py
parentba5059dd66310055116e77e0f1c57685830f1b84 (diff)
Only skip download if files exists; convert audio
Diffstat (limited to 'youtube_dl/__init__.py')
-rwxr-xr-xyoutube_dl/__init__.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index c2511e864..d02178cc3 100755
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -759,10 +759,6 @@ class FileDownloader(object):
if filename is None:
return
- if self.params.get('nooverwrites', False) and os.path.exists(filename):
- self.to_stderr(u'WARNING: file exists and will be skipped')
- return
-
try:
dn = os.path.dirname(filename)
if dn != '' and not os.path.exists(dn):
@@ -804,16 +800,19 @@ class FileDownloader(object):
return
if not self.params.get('skip_download', False):
- try:
- success = self._do_download(filename, info_dict)
- except (OSError, IOError), err:
- raise UnavailableVideoError
- except (urllib2.URLError, httplib.HTTPException, socket.error), err:
- self.trouble(u'ERROR: unable to download video data: %s' % str(err))
- return
- except (ContentTooShortError, ), err:
- self.trouble(u'ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
- return
+ if self.params.get('nooverwrites', False) and os.path.exists(filename):
+ success = True
+ else:
+ try:
+ success = self._do_download(filename, info_dict)
+ except (OSError, IOError), err:
+ raise UnavailableVideoError
+ except (urllib2.URLError, httplib.HTTPException, socket.error), err:
+ self.trouble(u'ERROR: unable to download video data: %s' % str(err))
+ return
+ except (ContentTooShortError, ), err:
+ self.trouble(u'ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
+ return
if success:
try: