X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube-dl;h=6b56f3f98f6b0e03c7d3b623ad3ff99591c2004c;hb=1c1821f8eb1b6c8f87e8038441343d887c8ef21f;hp=732ebce1d3283e2ec7b365eccc9a33e86394cd33;hpb=49c0028a7a1cb3c2f37770e4749a48ef0146fdfe;p=youtube-dl.git diff --git a/youtube-dl b/youtube-dl index 732ebce1d..6b56f3f98 100755 --- a/youtube-dl +++ b/youtube-dl @@ -316,10 +316,12 @@ class FileDownloader(object): """Process a single dictionary returned by an InfoExtractor.""" # Do nothing else if in simulate mode if self.params.get('simulate', False): - try: - info_dict['url'] = self.verify_url(info_dict['url'].encode('utf-8')).decode('utf-8') - except (OSError, IOError, urllib2.URLError, httplib.HTTPException, socket.error), err: - raise UnavailableFormatError + # Verify URL if it's an HTTP one + if info_dict['url'].startswith('http'): + try: + info_dict['url'] = self.verify_url(info_dict['url'].encode('utf-8')).decode('utf-8') + except (OSError, IOError, urllib2.URLError, httplib.HTTPException, socket.error), err: + raise UnavailableFormatError # Forced printings if self.params.get('forcetitle', False): @@ -411,11 +413,12 @@ class FileDownloader(object): # Download using rtmpdump. rtmpdump returns exit code 2 when # the connection was interrumpted and resuming appears to be # possible. This is part of rtmpdump's normal usage, AFAIK. - retval = subprocess.call(['rtmpdump', '-q', '-r', url, '-o', filename] + [[], ['-e']][self.params.get('continuedl', False)]) - while retval == 2: + basic_args = ['rtmpdump', '-q', '-r', url, '-o', filename] + retval = subprocess.call(basic_args + [[], ['-e', '-k', '1']][self.params.get('continuedl', False)]) + while retval == 2 or retval == 1: self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename), skip_eol=True) time.sleep(2.0) # This seems to be needed - retval = subprocess.call(['rtmpdump', '-q', '-e', '-r', url, '-o', filename]) + retval = subprocess.call(basic_args + ['-e'] + [[], ['-k', '1']][retval == 1]) if retval == 0: self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename)) return True