[downloader:ytdl] fix 'outtmpl' setting for yt_dlp (#1680)

yt_dlp supports multiple outtmpl settings for different file types and
uses its 'outtmpl_dict' for that.
pull/1730/head
Mike Fährmann 3 years ago
parent dfe1f490e9
commit fc19010808
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -88,7 +88,7 @@ class YoutubeDLDownloader(DownloaderBase):
info_dict["ext"] = "mkv"
if self.outtmpl:
self.ytdl.params["outtmpl"] = self.outtmpl
self._set_outtmpl(self.outtmpl)
pathfmt.filename = filename = self.ytdl.prepare_filename(info_dict)
pathfmt.extension = info_dict["ext"]
pathfmt.path = pathfmt.directory + filename
@ -103,7 +103,8 @@ class YoutubeDLDownloader(DownloaderBase):
if self.part and self.partdir:
pathfmt.temppath = os.path.join(
self.partdir, pathfmt.filename)
self.ytdl.params["outtmpl"] = pathfmt.temppath.replace("%", "%%")
self._set_outtmpl(pathfmt.temppath.replace("%", "%%"))
self.out.start(pathfmt.path)
try:
@ -115,12 +116,18 @@ class YoutubeDLDownloader(DownloaderBase):
def _download_playlist(self, pathfmt, info_dict):
pathfmt.set_extension("%(playlist_index)s.%(ext)s")
self.ytdl.params["outtmpl"] = pathfmt.realpath
self._set_outtmpl(pathfmt.realpath)
for entry in info_dict["entries"]:
self.ytdl.process_info(entry)
return True
def _set_outtmpl(self, outtmpl):
try:
self.ytdl.outtmpl_dict["default"] = outtmpl
except AttributeError:
self.ytdl.params["outtmpl"] = outtmpl
def compatible_formats(formats):
"""Returns True if 'formats' are compatible for merge"""

Loading…
Cancel
Save