your commit message

This commit is contained in:
2026-02-25 17:35:38 -08:00
parent 39a84b3274
commit 834be06ab9
12 changed files with 517 additions and 543 deletions

View File

@@ -54,6 +54,10 @@ resolve_target_dir = sh.resolve_target_dir
coerce_to_path = sh.coerce_to_path
build_pipeline_preview = sh.build_pipeline_preview
# URI scheme prefixes owned by AllDebrid (magic-link and emoji shorthand).
# Defined once here so every method in this file references the same constant.
_ALLDEBRID_PREFIXES: tuple[str, ...] = ("alldebrid:", "alldebrid🧲")
class Download_File(Cmdlet):
"""Class-based download-file cmdlet - direct HTTP downloads."""
@@ -652,9 +656,12 @@ class Download_File(Cmdlet):
notes: Optional[Dict[str, str]] = None
try:
if isinstance(full_metadata, dict):
subtitles = full_metadata.get("_tidal_lyrics_subtitles")
if isinstance(subtitles, str) and subtitles.strip():
notes = {"lyric": subtitles}
# Providers attach pre-built notes under the generic "_notes" key
# (e.g. Tidal sets {"lyric": subtitles} during download enrichment).
# This keeps provider-specific metadata handling inside the provider.
_provider_notes = full_metadata.get("_notes")
if isinstance(_provider_notes, dict) and _provider_notes:
notes = {str(k): str(v) for k, v in _provider_notes.items() if k and v}
except Exception:
notes = None
tag: List[str] = []
@@ -2787,7 +2794,9 @@ class Download_File(Cmdlet):
s_val = str(value or "").strip().lower()
except Exception:
return False
return s_val.startswith(("http://", "https://", "magnet:", "torrent:", "alldebrid:", "alldebrid🧲"))
return s_val.startswith(
("http://", "https://", "magnet:", "torrent:") + _ALLDEBRID_PREFIXES
)
def _extract_selection_args(item: Any) -> tuple[Optional[List[str]], Optional[str]]:
selection_args: Optional[List[str]] = None
@@ -2955,15 +2964,13 @@ class Download_File(Cmdlet):
and (not parsed.get("path"))):
candidate = str(raw_url[0] or "").strip()
low = candidate.lower()
looks_like_url = low.startswith((
"http://", "https://", "ftp://", "magnet:", "torrent:",
"alldebrid:", "alldebrid🧲"
))
looks_like_url = low.startswith(
("http://", "https://", "ftp://", "magnet:", "torrent:") + _ALLDEBRID_PREFIXES
)
looks_like_provider = (
":" in candidate and not candidate.startswith((
"http:", "https:", "ftp:", "ftps:", "file:",
"alldebrid:"
))
":" in candidate and not candidate.startswith(
("http:", "https:", "ftp:", "ftps:", "file:") + _ALLDEBRID_PREFIXES
)
)
looks_like_windows_path = (
(len(candidate) >= 2 and candidate[1] == ":")