This commit is contained in:
2026-02-10 23:00:30 -08:00
parent c2449d0ba7
commit 5323b7c76f
6 changed files with 192 additions and 104 deletions

View File

@@ -18,12 +18,13 @@ from contextlib import AbstractContextManager, nullcontext
from API.HTTP import _download_direct_file
from SYS.models import DownloadError, DownloadOptions, DownloadMediaResult
from SYS.logger import log, debug
from SYS.logger import log, debug, is_debug_enabled
from SYS.pipeline_progress import PipelineProgress
from SYS.result_table import Table
from SYS.rich_display import stderr_console as get_stderr_console
from SYS import pipeline as pipeline_context
from SYS.metadata import normalize_urls as normalize_url_list
from SYS.utils import sha256_file
from tool.ytdlp import (
YtDlpTool,
@@ -1495,6 +1496,41 @@ class Download_File(Cmdlet):
forced_single_applied = True
# Proactive fallback for single audio formats which might be unstable
if (
actual_format
and isinstance(actual_format, str)
and actual_format == "audio"
):
actual_format = "bestaudio/best"
# DEBUG: Render config panel for tracking pipeline state
if is_debug_enabled():
try:
from rich.table import Table as RichTable
from rich import box as RichBox
from tool.ytdlp import YtDlpDefaults
t = RichTable(title="Download Config", show_header=True, header_style="bold magenta", box=RichBox.ROUNDED)
t.add_column("Property", style="cyan")
t.add_column("Value", style="green")
t.add_row("URL", url)
t.add_row("Mode", mode)
t.add_row("Format", str(actual_format))
t.add_row("Playlist Items", str(actual_playlist_items))
# Browser/Cookie info from ytdlp tool
defaults = getattr(ytdlp_tool, "defaults", None)
if isinstance(defaults, YtDlpDefaults):
t.add_row("Cookie File", str(defaults.cookiefile or "None"))
t.add_row("Browser Cookies", str(defaults.cookies_from_browser or "None"))
t.add_row("User Agent", str(defaults.user_agent or "default"))
debug(t)
except Exception:
pass
# If no format explicitly chosen, we might want to check available formats
# and maybe show a table if multiple are available?
if (
actual_format
and isinstance(actual_format, str)