s
This commit is contained in:
@@ -1289,7 +1289,44 @@ class Tidal(Provider):
|
|||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
if downloaded:
|
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
|
return False, None
|
||||||
|
|
||||||
if view == "album":
|
if view == "album":
|
||||||
|
|||||||
@@ -2093,6 +2093,9 @@ class Folder(Store):
|
|||||||
if callable(setter):
|
if callable(setter):
|
||||||
setter(file_path, note_name, str(text))
|
setter(file_path, note_name, str(text))
|
||||||
return True
|
return True
|
||||||
|
try:
|
||||||
|
db.save_note(file_path, str(text), name=note_name)
|
||||||
|
except TypeError:
|
||||||
db.save_note(file_path, str(text))
|
db.save_note(file_path, str(text))
|
||||||
return True
|
return True
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -176,19 +176,42 @@ class Download_File(Cmdlet):
|
|||||||
try:
|
try:
|
||||||
handled, path = provider.handle_url(str(url), output_dir=final_output_dir)
|
handled, path = provider.handle_url(str(url), output_dir=final_output_dir)
|
||||||
if handled:
|
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(
|
self._emit_local_file(
|
||||||
downloaded_path=Path(str(path)),
|
downloaded_path=p_val,
|
||||||
source=str(url),
|
source=str(url),
|
||||||
title_hint=Path(str(path)).stem,
|
title_hint=str(title_hint) if title_hint else p_val.stem,
|
||||||
tags_hint=None,
|
tags_hint=tags_hint,
|
||||||
media_kind_hint="file",
|
media_kind_hint=str(media_kind_hint) if media_kind_hint else "file",
|
||||||
full_metadata=None,
|
full_metadata=extra_meta,
|
||||||
progress=progress,
|
progress=progress,
|
||||||
config=config,
|
config=config,
|
||||||
provider_hint=provider_name
|
provider_hint=provider_name
|
||||||
)
|
)
|
||||||
downloaded_count += 1
|
downloaded_count += 1
|
||||||
|
else:
|
||||||
|
debug(f"Provider {provider_name} handled URL without file output")
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
debug(f"Provider {provider_name} handle_url error: {e}")
|
debug(f"Provider {provider_name} handle_url error: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user