f
This commit is contained in:
@@ -931,7 +931,8 @@ class Download_File(Cmdlet):
|
||||
pass
|
||||
|
||||
transfer_label = label
|
||||
if str(table or "").lower() == "hifi":
|
||||
table_type = str(table or "").lower()
|
||||
if table_type == "tidal" or table_type.startswith("tidal."):
|
||||
try:
|
||||
progress.begin_transfer(label=transfer_label, total=None)
|
||||
except Exception:
|
||||
@@ -943,7 +944,9 @@ class Download_File(Cmdlet):
|
||||
provider_sr = None
|
||||
provider_obj = None
|
||||
if table and get_search_provider and SearchResult:
|
||||
provider_obj = get_search_provider(str(table), config)
|
||||
# Strip sub-table suffix (e.g. tidal.track -> tidal) to find the provider key
|
||||
provider_key = str(table).split(".")[0]
|
||||
provider_obj = get_search_provider(provider_key, config)
|
||||
if provider_obj is not None:
|
||||
attempted_provider_download = True
|
||||
sr = SearchResult(
|
||||
@@ -1160,14 +1163,7 @@ class Download_File(Cmdlet):
|
||||
pass
|
||||
|
||||
# Allow providers to add/enrich tags and metadata during download.
|
||||
if str(table or "").lower() == "libgen" and provider_sr is not None:
|
||||
try:
|
||||
sr_tags = getattr(provider_sr, "tag", None)
|
||||
if tags_list is None and isinstance(sr_tags, set) and sr_tags:
|
||||
tags_list = sorted([str(t) for t in sr_tags if t])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if provider_sr is not None:
|
||||
try:
|
||||
sr_md = getattr(provider_sr, "full_metadata", None)
|
||||
if isinstance(sr_md, dict) and sr_md:
|
||||
@@ -1183,6 +1179,15 @@ class Download_File(Cmdlet):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Prefer tags from the search result object if the provider mutated them during download.
|
||||
try:
|
||||
sr_tags = getattr(provider_sr, "tag", None)
|
||||
if isinstance(sr_tags, (set, list)) and sr_tags:
|
||||
# Re-sync tags_list with the potentially enriched provider_sr.tag
|
||||
tags_list = sorted([str(t) for t in sr_tags if t])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self._emit_local_file(
|
||||
downloaded_path=downloaded_path,
|
||||
source=str(target) if target else None,
|
||||
@@ -1201,7 +1206,8 @@ class Download_File(Cmdlet):
|
||||
except Exception as e:
|
||||
log(f"Error downloading item: {e}", file=sys.stderr)
|
||||
finally:
|
||||
if str(table or "").lower() == "hifi":
|
||||
table_type = str(table or "").lower()
|
||||
if table_type == "tidal" or table_type.startswith("tidal."):
|
||||
try:
|
||||
progress.finish_transfer(label=transfer_label)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user