Skip to content

tidal: add cover art support via coverArt relationship#6743

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

tidal: add cover art support via coverArt relationship#6743
arsaboo wants to merge 6 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.54%. Comparing base (60047df) to head (3c95393).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6743      +/-   ##
==========================================
+ Coverage   74.52%   74.54%   +0.01%     
==========================================
  Files         162      162              
  Lines       20818    20832      +14     
  Branches     3295     3299       +4     
==========================================
+ Hits        15515    15529      +14     
  Misses       4547     4547              
  Partials      756      756              
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
@semohr semohr added the tidal label Jun 15, 2026
Comment thread beetsplug/tidal/__init__.py Outdated
album: TidalAlbum,
track_by_id: dict[str, TidalTrack],
artist_by_id: dict[str, TidalArtist],
cover_art_by_id: dict[str, TidalCoverArt] | None = None,

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.

Can we make this required as it should be always returned now?

Comment thread beetsplug/tidal/__init__.py Outdated
files = cover_art["attributes"]["files"]
if files:
return files[0]["href"]
return f"https://resources.tidal.com/images/{ids[0]}/1280x1280.jpg"

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.

Im pretty sure this wont work. The id used here is empheral and should only be used locally to match included data to the relationships.

For the example from here the id is 2xpmpI1s9DzeAPMlmNh9kM and the link https://resources.tidal.com/images/2xpmpI1s9DzeAPMlmNh9kM/1280x1280.jpg will result in an error.

)

@staticmethod
def _parse_cover_art_url(

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.

Is there a way to pass multiple links to be used with fetchart? Fetchart has config options for min/maxwidth, right? We might be able to make use of the multiple files/artworks defined here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AlbumInfo.cover_art_url only accepts a single URL, so we pass the first/largest file and let fetchart handle any resizing via its maxwidth/minwidth config. The current approach already covers the best resolution.

Comment thread beetsplug/tidal/__init__.py
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