tidal: add cover art support via coverArt relationship#6743
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
- Make CoverArtAttributes.url NotRequired - Use direct index access on TypedDict instead of .get() to avoid mypy Never-type inference
- 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
| album: TidalAlbum, | ||
| track_by_id: dict[str, TidalTrack], | ||
| artist_by_id: dict[str, TidalArtist], | ||
| cover_art_by_id: dict[str, TidalCoverArt] | None = None, |
There was a problem hiding this comment.
Can we make this required as it should be always returned now?
| files = cover_art["attributes"]["files"] | ||
| if files: | ||
| return files[0]["href"] | ||
| return f"https://resources.tidal.com/images/{ids[0]}/1280x1280.jpg" |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Description
Include
coverArtin album API requests and parse thecoverArtsresources from the included array. Thecover_art_urlis passed toAlbumInfo(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.docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)cc: @semohr This is the first PR. I will add another one for
popularitysoon.