aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/external.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-05-01 21:28:30 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-05-02 14:03:13 +0530
commiteb55bad5a0c1af9388301ffbf17845ee53a41635 (patch)
treebda5e94f79484327e2ba32e19aa87a4b8b6a7969 /yt_dlp/downloader/external.py
parentcc0ec3e16119df54ff69fc26d45f2bfa954814c2 (diff)
downloadhypervideo-pre-eb55bad5a0c1af9388301ffbf17845ee53a41635.tar.lz
hypervideo-pre-eb55bad5a0c1af9388301ffbf17845ee53a41635.tar.xz
hypervideo-pre-eb55bad5a0c1af9388301ffbf17845ee53a41635.zip
[aria2c] Fix whitespace being stripped off
Closes #276
Diffstat (limited to 'yt_dlp/downloader/external.py')
-rw-r--r--yt_dlp/downloader/external.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 70da63f69..d879bc66d 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -290,11 +290,19 @@ class Aria2cFD(ExternalFD):
cmd += self._bool_option('--remote-time', 'updatetime', 'true', 'false', '=')
cmd += self._configuration_args()
+ # aria2c strips out spaces from the beginning/end of filenames and paths.
+ # We work around this issue by adding a "./" to the beginning of the
+ # filename and relative path, and adding a "/" at the end of the path.
+ # See: https://github.com/yt-dlp/yt-dlp/issues/276
+ # https://github.com/ytdl-org/youtube-dl/issues/20312
+ # https://github.com/aria2/aria2/issues/1373
dn = os.path.dirname(tmpfilename)
if dn:
- cmd += ['--dir', dn]
+ if not os.path.isabs(dn):
+ dn = '.%s%s' % (os.path.sep, dn)
+ cmd += ['--dir', dn + os.path.sep]
if 'fragments' not in info_dict:
- cmd += ['--out', os.path.basename(tmpfilename)]
+ cmd += ['--out', '.%s%s' % (os.path.sep, os.path.basename(tmpfilename))]
cmd += ['--auto-file-renaming=false']
if 'fragments' in info_dict: