Skip to content

tidal: add cover art support via coverArt relationship#6743

Open
arsaboo wants to merge 8 commits into
beetbox:masterfrom
arsaboo:tidal-coverart
Open

tidal: add cover art support via coverArt relationship#6743
arsaboo wants to merge 8 commits into
beetbox:masterfrom
arsaboo:tidal-coverart

Conversation

@arsaboo

@arsaboo arsaboo commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Description

Include coverArt in album API requests and parse the coverArts resources from the included array. The cover_art_url is passed to AlbumInfo(cover_art_url=...), which the fetchart plugin uses to retrieve album art. Falls back to constructing a URL from the cover art resource ID when no direct URL is available in the API response.

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

cc: @semohr This is the first PR. I will add another one for popularity soon.

@arsaboo arsaboo requested review from a team and semohr as code owners June 14, 2026 18:29
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.62%. Comparing base (73605d5) to head (8435319).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6743      +/-   ##
==========================================
+ Coverage   74.60%   74.62%   +0.01%     
==========================================
  Files         163      163              
  Lines       20830    20844      +14     
  Branches     3283     3287       +4     
==========================================
+ Hits        15541    15555      +14     
  Misses       4538     4538              
  Partials      751      751              
Files with missing lines Coverage Δ
beetsplug/tidal/__init__.py 86.43% <100.00%> (+1.02%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Make CoverArtAttributes.url NotRequired

- Use direct index access on TypedDict instead of .get() to avoid mypy Never-type inference
@semohr semohr self-assigned this Jun 14, 2026
arsaboo added 2 commits June 14, 2026 15:05
- Fix mypy: avoid {} default in relationships.get() that creates Never type

- Fix doc build: use :doc:\etchart\ instead of :doc:\plugins/fetchart\ from within plugins/ directory
Comment thread beetsplug/tidal/api_types.py Outdated
@semohr semohr added the tidal label Jun 15, 2026
Comment thread beetsplug/tidal/__init__.py Outdated
Comment thread beetsplug/tidal/__init__.py Outdated
Comment thread beetsplug/tidal/__init__.py Outdated
Comment thread beetsplug/tidal/__init__.py
Comment thread beetsplug/tidal/api_types.py Outdated
visualMetadata: NotRequired[dict[str, str]]


class TidalCoverArt(TypedDict):

@semohr semohr Jun 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets name all these typeddict consistent with the tidal api and use Artwork instead of CoverArt.

Comment thread beetsplug/tidal/__init__.py Outdated

@staticmethod
def _parse_cover_art_url(
album: TidalAlbum, cover_art_by_id: dict[str, TidalCoverArt]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more compact and less readable ;)

    for item in album["relationships"].get("coverArt", {}).get("data", []):
        if item.get("type") == "artworks" and (files := cover_art_by_id.get(item.get("id"), {}).get("attributes", {}).get("files")):
            return files[0].get("href") if files else None
    return None

Comment thread test/plugins/test_tidal.py Outdated
"links": {},
},
},
"relationships": relationships, # type: ignore[typeddict-item]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not introduce a type ignore please. We should be able to type this with
dict[str, RelationshipData].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants