summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/helper/metadata_utils.py
diff options
context:
space:
mode:
authorWarry <FunWarry@users.noreply.github.com>2025-12-29 20:05:34 +0100
committerWarry <FunWarry@users.noreply.github.com>2025-12-29 20:05:34 +0100
commitf413240b51f574c01144e6ae672b24c412a949e1 (patch)
treeee26239282d17057a5eabd7a7b130c248b380f9d /tidal_dl_ng/helper/metadata_utils.py
parent296c6c7d6b319b38958b2aacb9904f18f6f46fd1 (diff)
downloadtidal-dl-ng-f413240b51f574c01144e6ae672b24c412a949e1.tar.gz
feat: Enhance playlist management and GUI logic
- Improved playlist item fetching by adding robust pagination and low-level request hooks for better testing and flexibility. - Refactored track ID extraction logic into reusable helpers for clarity. - Improved initialization for dialog components to avoid circular dependencies in the GUI. - Added new unit tests to validate playlist operations, including track addition/removal and API integration. - Updated metadata functions to simplify dictionary access using `.get` for better readability. - Ensured PySide6 system dependencies are installed in GitHub Actions to address CI compatibility issues. - Streamlined UI package initialization to improve modularity and robustness of imports.
Diffstat (limited to 'tidal_dl_ng/helper/metadata_utils.py')
-rw-r--r--tidal_dl_ng/helper/metadata_utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tidal_dl_ng/helper/metadata_utils.py b/tidal_dl_ng/helper/metadata_utils.py
index eac69bd..5142294 100644
--- a/tidal_dl_ng/helper/metadata_utils.py
+++ b/tidal_dl_ng/helper/metadata_utils.py
@@ -14,10 +14,10 @@ def _convert_list_to_str(value: list | tuple) -> str:
def _convert_dict_to_str(value: dict) -> str:
"""Extract meaningful string from dict."""
- if "name" in value and value["name"]:
+ if value.get("name"):
return str(value["name"])
for k in ("label", "title", "genre", "name"):
- if k in value and value[k]:
+ if value.get(k):
return str(value[k])
with suppress(Exception):
vals = [str(v) for v in value.values() if v is not None]
@@ -177,7 +177,7 @@ def _extract_name_from_item(item: object) -> str | None:
if isinstance(item, dict):
# Try common name keys
for k in ("name", "artist", "person"):
- if k in item and item[k]:
+ if item.get(k):
return str(item[k])
return None
# Try object attributes