Improve rtmpdump support

This commit is contained in:
Ricardo Garcia 2010-01-19 20:04:56 +01:00
parent 60f8049d05
commit 1c1821f8eb

View file

@ -413,11 +413,12 @@ class FileDownloader(object):
# Download using rtmpdump. rtmpdump returns exit code 2 when # Download using rtmpdump. rtmpdump returns exit code 2 when
# the connection was interrumpted and resuming appears to be # the connection was interrumpted and resuming appears to be
# possible. This is part of rtmpdump's normal usage, AFAIK. # 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)]) basic_args = ['rtmpdump', '-q', '-r', url, '-o', filename]
while retval == 2: 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) self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename), skip_eol=True)
time.sleep(2.0) # This seems to be needed 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: if retval == 0:
self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename)) self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename))
return True return True