mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 13:35:01 +00:00
fix: carry retry context through url indirection and re-gate retry options
Two review fixes on top of the retry endpoint: - __add_entry dropped retry_entry when extraction returned an unprocessed url/url_transparent result and it recursed back into add(). Since __extract_info runs with extract_flat=True, that path is live, and a retried playlist item taking it fell back to OUTPUT_TEMPLATE and landed in the root directory instead of its playlist folder. The playlist child loop keeps passing retry_entry=None on purpose: those entries get fresh playlist context stamped on them from the current extraction. - retry() called dqueue.add() directly, so it bypassed the parse_download_options gates that /add applies. Stored ytdl_options_overrides were re-applied even after ALLOW_YTDL_OPTIONS_OVERRIDES was turned off, and preset names removed from the configuration were still passed through. Both are re-checked against the current configuration at retry time.
This commit is contained in:
+16
-2
@@ -1398,6 +1398,7 @@ class DownloadQueue:
|
||||
clip_end,
|
||||
already,
|
||||
_add_gen=None,
|
||||
retry_entry=None,
|
||||
):
|
||||
if not entry:
|
||||
return {'status': 'error', 'msg': "Invalid/empty data was given."}
|
||||
@@ -1416,6 +1417,10 @@ class DownloadQueue:
|
||||
|
||||
if etype.startswith('url'):
|
||||
log.debug('Processing as a url')
|
||||
# retry_entry must ride along: extraction can hand back an
|
||||
# unprocessed url/url_transparent result, and dropping the retry
|
||||
# context here would send the retried item back to the root
|
||||
# directory instead of its original playlist folder.
|
||||
return await self.add(
|
||||
entry['url'],
|
||||
download_type,
|
||||
@@ -1436,6 +1441,7 @@ class DownloadQueue:
|
||||
clip_end,
|
||||
already,
|
||||
_add_gen,
|
||||
retry_entry,
|
||||
)
|
||||
elif etype == 'playlist' or etype == 'channel':
|
||||
if etype == 'playlist' and self.__is_channel_extraction(entry):
|
||||
@@ -1687,6 +1693,7 @@ class DownloadQueue:
|
||||
clip_end,
|
||||
already,
|
||||
_add_gen,
|
||||
retry_entry,
|
||||
)
|
||||
|
||||
async def retry(self, id):
|
||||
@@ -1697,6 +1704,13 @@ class DownloadQueue:
|
||||
if info.status != 'error':
|
||||
return {'status': 'error', 'msg': 'Only failed downloads can be retried.'}
|
||||
|
||||
# The stored options were validated by parse_download_options when the
|
||||
# download was first submitted, but the configuration can have changed
|
||||
# since. Re-apply the same gates here so a retry can't resurrect
|
||||
# overrides or presets the current configuration no longer allows.
|
||||
overrides = info.ytdl_options_overrides if self.config.ALLOW_YTDL_OPTIONS_OVERRIDES else {}
|
||||
presets = [p for p in info.ytdl_options_presets if p in self.config.YTDL_OPTIONS_PRESETS]
|
||||
|
||||
return await self.add(
|
||||
info.url,
|
||||
info.download_type,
|
||||
@@ -1711,8 +1725,8 @@ class DownloadQueue:
|
||||
info.chapter_template,
|
||||
info.subtitle_language,
|
||||
info.subtitle_mode,
|
||||
info.ytdl_options_presets,
|
||||
info.ytdl_options_overrides,
|
||||
presets,
|
||||
overrides,
|
||||
info.clip_start,
|
||||
info.clip_end,
|
||||
retry_entry=info.entry,
|
||||
|
||||
Reference in New Issue
Block a user