Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6520 +/- ##
==========================================
- Coverage 71.86% 71.75% -0.11%
==========================================
Files 156 159 +3
Lines 20181 20515 +334
Branches 3211 3262 +51
==========================================
+ Hits 14503 14721 +218
- Misses 5000 5105 +105
- Partials 678 689 +11
🚀 New features to boost your workflow:
|
347624d to
452868d
Compare
There was a problem hiding this comment.
Pull request overview
grug see PR add new tidal metadata source plugin so beets autotagger can fetch album/track metadata from Tidal API, with auth flow + small API client layer.
Changes:
- add Tidal plugin (
TidalPlugin) with album/track lookup, search, and JSON:API parsing - add OAuth2 PKCE auth + token save/refresh + rate limited session + pagination merge
- add docs + changelog + initial unit tests, plus shared RateLimitAdapter + tidal id extractor
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
beetsplug/tidal/__init__.py |
main metadata source plugin logic (lookup, search, parse to AlbumInfo/TrackInfo) |
beetsplug/tidal/api.py |
TidalSession (auth, refresh, rate limit, pagination) + TidalAPI endpoints |
beetsplug/tidal/authenticate.py |
PKCE browser/manual redirect auth flow + token serialization |
beetsplug/tidal/api_types.py |
TypedDict models for Tidal JSON:API responses |
beetsplug/_utils/requests.py |
add RateLimitAdapter for shared request throttling |
beets/util/id_extractors.py |
add/update Tidal ID extraction regex |
docs/plugins/tidal.rst |
new user docs for tidal plugin + config + auth usage |
docs/plugins/index.rst |
add tidal to plugin docs index |
docs/changelog.rst |
add changelog entry for new plugin |
test/plugins/test_tidal.py |
add parsing + lookup unit tests with mocked API |
.github/CODEOWNERS |
assign ownership for new tidal plugin folder |
|
Yes, I'm still around. Sorry, life was pretty busy over the past year and I lost track even though I did see your original comment. The code looks really good, and I never realized TIDAL allows for ISRC/UPC lookup (very useful). I am wondering, why are we rolling our own API wrapper here? |
|
No worries. I know how it goes. Really glad you’re still around!
We’ve run into issues before with API dependencies in beets not being well maintained, so this felt like a safer path. On top of that, we likely wouldn’t need most of the features a full-fledged API library would bring anyway. I’m not completely set on this approach, but we recently did something similar with musicbrainz, so it feels like a reasonable direction for now. I also noticed that your original PRs included quite a few more features (art, label regex, popularity, etc.). I’d definitely love to revisit those and would be happy to have you onboard for future enhancements/PRs build ontop of this one (ofc. only if you have the time and are interested in continuing to contribute). |
|
It may be worthwhile to at least get album art and popularity in this iteration if it is not too much of a change. I understand if we want to leave it for a subsequent PR. |
|
Sounds great to me. The reason I went with an external API was to avoid having to work on oauth authentication, but it does make more sense to maintain our own wrapper. I'd be willing to help maintain this plugin. The main thing I'm wondering is if we should implement album art here or in fetchart? |
|
@jcjordyn130 it should probably be part of fetchart (where other sources are identified) as long as the wrapper provides the pipeline. |
I think reviewing this will already be challenging because of the size 😨 If we already want to work on these features tho, how about we create additional PRs and base them on this branch? |
snejus
left a comment
There was a problem hiding this comment.
👏🏼 that's some good work here, added a couple of comments but nothing very significant
3f57edb to
1dfc8b7
Compare
snejus
left a comment
There was a problem hiding this comment.
Looks good, I can see requests-oauthlib slightly simplified the auth! A couple of comments
…ndled in the session.
amount of refactoring but im more happy with the abstraction now.
- too strict ids - typos and docstring improvements
…d but a good thing to have.
- Renamed id to _id - Aligned line breaks for some comment with actual ruff line length - Removed comment dividers - Removed a number of unnecessary or duplicate comments
- Renamed _extract_* methods to _parse_*
- Renamed release to date_parts
- Using .get instead of .request("GET"...)
Description
This PR introduces tidal as metadatasource. It add both an minimal api layer and the typical metadata source plugin capabilities.
Details
The implementation provides a small API layer consisting of
TidalAPIfor high-level album and track fetching, andTidalSessionwhich extendsrequests.Sessionwith token authentication, automatic rate limiting (~4 req/s viaRateLimitAdapter), and pagination resolution following the JSON:API spec.Authentication is handled through an OAuth2 PKCE flow accessible via
beet tidal --auth, with automatic token refresh when the access token expires.Metadata parsing handles Tidal's JSON:API response format, extracting album and track information including ISO 8601 duration conversion, artist relationships, and copyright/label data.
Input wanted
The API layer currently lacks comprehensive test coverage. Setting up proper tests would require either mocking all outgoing requests or creating a dedicated test token (which necessitates an account and might require read/write to github secrets).
Are we comfortable with the current approach of unit testing the plugin itself while mocking all requests?
TODOs
candidateanditem_candidateslookupRefs
thanks to @jcjordyn130 for his initial implementations in #5637 and #4641