This commit is contained in:
2026-01-16 20:08:22 -08:00
parent 385307c5b9
commit a4d44e6190
3 changed files with 72 additions and 9 deletions

View File

@@ -1289,7 +1289,44 @@ class Tidal(Provider):
return False, None
if downloaded:
return True, downloaded
meta = None
try:
if isinstance(getattr(result, "full_metadata", None), dict):
meta = dict(result.full_metadata)
except Exception:
meta = None
if meta is None and isinstance(detail, dict):
meta = dict(detail)
title_hint = None
try:
title_hint = str(getattr(result, "title", "") or "").strip()
except Exception:
title_hint = None
if not title_hint or title_hint.lower().startswith("track "):
if isinstance(meta, dict):
title_hint = stringify(meta.get("title")) or title_hint
tags_hint: Optional[List[str]] = None
try:
tags_val = getattr(result, "tag", None)
if isinstance(tags_val, (set, list, tuple)):
tags_hint = [str(t) for t in tags_val if t]
except Exception:
tags_hint = None
if not tags_hint and isinstance(meta, dict):
try:
tags_hint = [str(t) for t in build_track_tags(meta) if t]
except Exception:
tags_hint = None
return True, {
"path": str(downloaded),
"title": title_hint,
"tags": tags_hint,
"full_metadata": meta,
"media_kind": "audio",
}
return False, None
if view == "album":

View File

@@ -2093,7 +2093,10 @@ class Folder(Store):
if callable(setter):
setter(file_path, note_name, str(text))
return True
db.save_note(file_path, str(text))
try:
db.save_note(file_path, str(text), name=note_name)
except TypeError:
db.save_note(file_path, str(text))
return True
except Exception as exc:
debug(f"set_note failed for local file: {exc}")

View File

@@ -176,19 +176,42 @@ class Download_File(Cmdlet):
try:
handled, path = provider.handle_url(str(url), output_dir=final_output_dir)
if handled:
if path:
extra_meta = None
title_hint = None
tags_hint: Optional[List[str]] = None
media_kind_hint = None
path_value: Optional[Any] = path
if isinstance(path, dict):
path_value = path.get("path") or path.get("file_path")
extra_meta = path.get("metadata") or path.get("full_metadata")
title_hint = path.get("title") or path.get("name")
media_kind_hint = path.get("media_kind")
tags_val = path.get("tags") or path.get("tag")
if isinstance(tags_val, (list, tuple, set)):
tags_hint = [str(t) for t in tags_val if t]
elif isinstance(tags_val, str) and tags_val.strip():
tags_hint = [str(tags_val).strip()]
if path_value:
p_val = Path(str(path_value))
if not title_hint and isinstance(extra_meta, dict):
title_hint = extra_meta.get("title") or extra_meta.get("name")
self._emit_local_file(
downloaded_path=Path(str(path)),
downloaded_path=p_val,
source=str(url),
title_hint=Path(str(path)).stem,
tags_hint=None,
media_kind_hint="file",
full_metadata=None,
title_hint=str(title_hint) if title_hint else p_val.stem,
tags_hint=tags_hint,
media_kind_hint=str(media_kind_hint) if media_kind_hint else "file",
full_metadata=extra_meta,
progress=progress,
config=config,
provider_hint=provider_name
)
downloaded_count += 1
downloaded_count += 1
else:
debug(f"Provider {provider_name} handled URL without file output")
continue
except Exception as e:
debug(f"Provider {provider_name} handle_url error: {e}")