projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b95aab8
)
[downloader/external] Add curl and aria2c (Closes #182)
author
Philipp Hagemeister
<phihag@phihag.de>
Sat, 24 Jan 2015 12:33:45 +0000
(13:33 +0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Sat, 24 Jan 2015 12:33:45 +0000
(13:33 +0100)
youtube_dl/downloader/external.py
patch
|
blob
|
history
diff --git
a/youtube_dl/downloader/external.py
b/youtube_dl/downloader/external.py
index c055962550b5a7e5d73a898d2cdf5e20d34d13a9..7ebe400969cf3c66b7ece2046526d7085cbac43a 100644
(file)
--- a/
youtube_dl/downloader/external.py
+++ b/
youtube_dl/downloader/external.py
@@
-97,13
+97,22
@@
class ExternalFD(FileDownloader):
self._debug_cmd(cmd, subprocess_encoding)
p = subprocess.Popen(
self._debug_cmd(cmd, subprocess_encoding)
p = subprocess.Popen(
- cmd, std
out=subprocess.PIPE, std
err=subprocess.PIPE)
-
stdout
, stderr = p.communicate()
+ cmd, stderr=subprocess.PIPE)
+
_
, stderr = p.communicate()
if p.returncode != 0:
self.to_stderr(stderr)
return p.returncode
if p.returncode != 0:
self.to_stderr(stderr)
return p.returncode
+class CurlFD(ExternalFD):
+ def _make_cmd(self, tmpfilename, info_dict):
+ cmd = [self.exe, '-o', tmpfilename]
+ for key, val in self._calc_headers(info_dict).items():
+ cmd += ['--header', '%s: %s' % (key, val)]
+ cmd += ['--', info_dict['url']]
+ return cmd
+
+
class WgetFD(ExternalFD):
def _make_cmd(self, tmpfilename, info_dict):
cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies']
class WgetFD(ExternalFD):
def _make_cmd(self, tmpfilename, info_dict):
cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies']
@@
-113,6
+122,20
@@
class WgetFD(ExternalFD):
return cmd
return cmd
+class Aria2cFD(ExternalFD):
+ def _make_cmd(self, tmpfilename, info_dict):
+ cmd = [
+ self.exe, '-c',
+ '--min-split-size', '1M', '--max-connection-per-server', '4']
+ dn = os.path.dirname(tmpfilename)
+ if dn:
+ cmd += ['--dir', dn]
+ cmd += ['--out', os.path.basename(tmpfilename)]
+ for key, val in self._calc_headers(info_dict).items():
+ cmd += ['--header', '%s: %s' % (key, val)]
+ cmd += ['--', info_dict['url']]
+ return cmd
+
_BY_NAME = dict(
(klass.get_basename(), klass)
for name, klass in globals().items()
_BY_NAME = dict(
(klass.get_basename(), klass)
for name, klass in globals().items()