projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd8a07a
)
[downloader/rtmp] Fix arguments encoding and simplify retry logic (Closes #5528)
author
Sergey M․
<dstftw@gmail.com>
Sat, 25 Apr 2015 22:32:54 +0000
(
04:32
+0600)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 25 Apr 2015 22:32:54 +0000
(
04:32
+0600)
youtube_dl/downloader/rtmp.py
patch
|
blob
|
history
diff --git
a/youtube_dl/downloader/rtmp.py
b/youtube_dl/downloader/rtmp.py
index ddf5724ae6f05259194c67473bfd212ddeb896ff..6865b5e2fb9d9e967fce3dd9f171a2c1a36f04f5 100644
(file)
--- a/
youtube_dl/downloader/rtmp.py
+++ b/
youtube_dl/downloader/rtmp.py
@@
-3,7
+3,6
@@
from __future__ import unicode_literals
import os
import re
import subprocess
import os
import re
import subprocess
-import sys
import time
from .common import FileDownloader
import time
from .common import FileDownloader
@@
-11,6
+10,7
@@
from ..compat import compat_str
from ..utils import (
check_executable,
encodeFilename,
from ..utils import (
check_executable,
encodeFilename,
+ encodeArgument,
get_exe_version,
)
get_exe_version,
)
@@
-121,7
+121,7
@@
class RtmpFD(FileDownloader):
# possible. This is part of rtmpdump's normal usage, AFAIK.
basic_args = [
'rtmpdump', '--verbose', '-r', url,
# possible. This is part of rtmpdump's normal usage, AFAIK.
basic_args = [
'rtmpdump', '--verbose', '-r', url,
- '-o',
encodeFilename(tmpfilename, True)
]
+ '-o',
tmpfilename
]
if player_url is not None:
basic_args += ['--swfVfy', player_url]
if page_url is not None:
if player_url is not None:
basic_args += ['--swfVfy', player_url]
if page_url is not None:
@@
-154,16
+154,9
@@
class RtmpFD(FileDownloader):
if not live and continue_dl:
args += ['--skip', '1']
if not live and continue_dl:
args += ['--skip', '1']
- if sys.platform == 'win32' and sys.version_info < (3, 0):
- # Windows subprocess module does not actually support Unicode
- # on Python 2.x
- # See http://stackoverflow.com/a/9951851/35070
- subprocess_encoding = sys.getfilesystemencoding()
- args = [a.encode(subprocess_encoding, 'ignore') for a in args]
- else:
- subprocess_encoding = None
+ args = [encodeArgument(a) for a in args]
- self._debug_cmd(args,
subprocess_encoding,
exe='rtmpdump')
+ self._debug_cmd(args, exe='rtmpdump')
RD_SUCCESS = 0
RD_FAILED = 1
RD_SUCCESS = 0
RD_FAILED = 1
@@
-180,7
+173,11
@@
class RtmpFD(FileDownloader):
prevsize = os.path.getsize(encodeFilename(tmpfilename))
self.to_screen('[rtmpdump] %s bytes' % prevsize)
time.sleep(5.0) # This seems to be needed
prevsize = os.path.getsize(encodeFilename(tmpfilename))
self.to_screen('[rtmpdump] %s bytes' % prevsize)
time.sleep(5.0) # This seems to be needed
- retval = run_rtmpdump(basic_args + ['-e'] + [[], ['-k', '1']][retval == RD_FAILED])
+ args = basic_args + ['--resume']
+ if retval == RD_FAILED:
+ args += ['--skip', '1']
+ args = [encodeArgument(a) for a in args]
+ retval = run_rtmpdump(args)
cursize = os.path.getsize(encodeFilename(tmpfilename))
if prevsize == cursize and retval == RD_FAILED:
break
cursize = os.path.getsize(encodeFilename(tmpfilename))
if prevsize == cursize and retval == RD_FAILED:
break