Split Apple Music provider into modular structure#3715
Split Apple Music provider into modular structure#3715MarvinSchenkel merged 7 commits intomusic-assistant:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the Apple Music provider into a modular layout (API client, parsers, and manager classes) to replace the prior monolithic implementation and make future feature additions (e.g., podcasts) easier to maintain.
Changes:
- Introduces
AppleMusicProvideras a thin facade delegating to dedicated manager modules (library/media/recommendations/streaming). - Adds a standalone
AppleMusicAPIClientand shared parse helpers for Apple Music API objects. - Centralizes provider constants and updates helper imports to the new module structure.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| music_assistant/providers/apple_music/init.py | Keeps setup/config-entry logic and exports the provider in the new structure. |
| music_assistant/providers/apple_music/provider.py | New provider facade delegating behavior to manager classes. |
| music_assistant/providers/apple_music/api_client.py | New centralized HTTP client and Apple Music ID/type utilities. |
| music_assistant/providers/apple_music/constants.py | Centralizes provider constants and supported feature set. |
| music_assistant/providers/apple_music/parsers.py | New standalone parsers for artist/album/track/playlist/station objects. |
| music_assistant/providers/apple_music/media.py | New catalog/search/media lookup manager. |
| music_assistant/providers/apple_music/library.py | New library CRUD/ratings manager. |
| music_assistant/providers/apple_music/recommendations.py | New recommendations/stations/similar tracks manager. |
| music_assistant/providers/apple_music/streaming.py | New streaming + Widevine decryption manager. |
| music_assistant/providers/apple_music/helpers/browse.py | Updates type-check import to the new provider module path. |
…-strings, safe dict access, cdm.close() in finally
MarvinSchenkel
left a comment
There was a problem hiding this comment.
Love the refactor, makes things way easier to digest. Few minor comments
|
@MarvinSchenkel Thanks! All comments have been addressed — the wrapper methods in |
MarvinSchenkel
left a comment
There was a problem hiding this comment.
Awesome stuff, thanks a bunch @dmoo500 👏
Summary
Refactors the Apple Music provider from a 1464-line monolith (
__init__.py) into a modular structure following the pattern established by the Tidal provider.New module structure
__init__.pysetup()+get_config_entries()only (MusicKit OAuth flow, unchanged)provider.pyAppleMusicProviderclass delegating to manager classesconstants.pySUPPORTED_FEATURES,CONF_*, etc.)api_client.pyAppleMusicAPIClient— all HTTP communication with the Apple Music APIparsers.pylibrary.pyAppleMusicLibraryManager— library CRUD and ratingsmedia.pyAppleMusicMediaManager— catalog reads and searchrecommendations.pyAppleMusicRecommendationManager— recommendations, stations, similar tracksstreaming.pyAppleMusicStreamingManager— Widevine decryption and stream URL resolutionMotivation
This is a prerequisite for adding podcast support inside the Apple Music provider (as suggested in discussion #5215), without the new code getting lost in an already large file.
No functional changes — this is a pure structural refactor.