df
This commit is contained in:
@@ -7,7 +7,7 @@ import re
|
||||
import subprocess
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from pathlib import Path
|
||||
from cmdlet._shared import Cmdlet, CmdletArg, parse_cmdlet_args
|
||||
from cmdlet._shared import Cmdlet, CmdletArg, parse_cmdlet_args, resolve_tidal_manifest_path
|
||||
from SYS.logger import debug, get_thread_stream, is_debug_enabled, set_debug, set_thread_stream
|
||||
from SYS.result_table import ResultTable
|
||||
from MPV.mpv_ipc import MPV
|
||||
@@ -723,6 +723,28 @@ def _get_playable_path(
|
||||
"none"}:
|
||||
path = None
|
||||
|
||||
manifest_path = resolve_tidal_manifest_path(item)
|
||||
if manifest_path:
|
||||
path = manifest_path
|
||||
else:
|
||||
# If this is a hifi:// placeholder and we couldn't resolve a manifest, do not fall back.
|
||||
try:
|
||||
if isinstance(path, str) and path.strip().lower().startswith("hifi:"):
|
||||
try:
|
||||
meta = None
|
||||
if isinstance(item, dict):
|
||||
meta = item.get("full_metadata") or item.get("metadata")
|
||||
else:
|
||||
meta = getattr(item, "full_metadata", None) or getattr(item, "metadata", None)
|
||||
if isinstance(meta, dict) and meta.get("_tidal_manifest_error"):
|
||||
print(str(meta.get("_tidal_manifest_error")), file=sys.stderr)
|
||||
except Exception:
|
||||
pass
|
||||
print("HIFI selection has no playable DASH MPD manifest.", file=sys.stderr)
|
||||
return None
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if title is not None and not isinstance(title, str):
|
||||
title = str(title)
|
||||
|
||||
@@ -885,6 +907,25 @@ def _queue_items(
|
||||
|
||||
target, title = result
|
||||
|
||||
# MPD/DASH playback requires ffmpeg protocol whitelist (file + https + crypto etc).
|
||||
# Set it via IPC before loadfile so the currently running MPV can play the manifest.
|
||||
try:
|
||||
target_str = str(target or "")
|
||||
if re.search(r"\.mpd($|\?)", target_str.lower()):
|
||||
_send_ipc_command(
|
||||
{
|
||||
"command": [
|
||||
"set_property",
|
||||
"options/demuxer-lavf-o",
|
||||
"protocol_whitelist=file,https,tcp,tls,crypto,data",
|
||||
],
|
||||
"request_id": 198,
|
||||
},
|
||||
silent=True,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# If the target is an AllDebrid protected file URL, unlock it to a direct link for MPV.
|
||||
try:
|
||||
if isinstance(target, str):
|
||||
@@ -1894,6 +1935,27 @@ def _start_mpv(
|
||||
"--ytdl-format=bestvideo[height<=?1080]+bestaudio/best[height<=?1080]",
|
||||
]
|
||||
|
||||
# If we are going to play a DASH MPD, allow ffmpeg to fetch https segments referenced by the manifest.
|
||||
try:
|
||||
needs_mpd_whitelist = False
|
||||
for it in items or []:
|
||||
mpd = resolve_tidal_manifest_path(it)
|
||||
candidate = mpd
|
||||
if not candidate:
|
||||
if isinstance(it, dict):
|
||||
candidate = it.get("path") or it.get("url")
|
||||
else:
|
||||
candidate = getattr(it, "path", None) or getattr(it, "url", None)
|
||||
if candidate and re.search(r"\.mpd($|\?)", str(candidate).lower()):
|
||||
needs_mpd_whitelist = True
|
||||
break
|
||||
if needs_mpd_whitelist:
|
||||
extra_args.append(
|
||||
"--demuxer-lavf-o=protocol_whitelist=file,https,tcp,tls,crypto,data"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Optional: borderless window (useful for uosc-like overlay UI without fullscreen).
|
||||
if start_opts and start_opts.get("borderless"):
|
||||
extra_args.append("--border=no")
|
||||
|
||||
Reference in New Issue
Block a user