Smart playlist plugin#3630
Conversation
…lbum names in rules
- Fix parse_uri unpacking order (provider/item_id were swapped) - Fix _evaluate_and returning all library tracks for seed-only rules - Apply genre filter (AND mode) to similar tracks (best-effort) - Apply year filter to similar tracks (keep tracks with missing year metadata) - Add seed_track_name field for human-readable playlist description - Fix human_readable(): seed_track was incorrectly nested inside album_ids block
🔒 Dependency Security Report✅ No dependency changes detected in this PR. |
There was a problem hiding this comment.
Pull request overview
Adds a new “Smart Playlist” provider that lets Music Assistant expose rule-based library playlists (including seed/similar-track mode) and includes a dedicated test suite for rules/validation/evaluation.
Changes:
- Introduces
SmartPlaylistProvider(music provider) with persisted rule storage, playlist generation, and custom API endpoints for CRUD + preview/count/generate. - Adds
SmartPlaylistRules+ validation + JSON read/write helpers. - Adds provider assets (manifest + icon) and a new pytest module covering core rule behavior.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
music_assistant/providers/smart_playlist/__init__.py |
Implements the provider, rule evaluation, persistence, and API commands. |
music_assistant/providers/smart_playlist/helpers.py |
Defines the rules dataclass, validation, and JSON I/O helpers. |
music_assistant/providers/smart_playlist/manifest.json |
Registers the provider and its metadata/docs link. |
music_assistant/providers/smart_playlist/icon.svg |
Adds provider icon used for playlist imagery. |
tests/providers/test_smart_playlist.py |
Adds unit tests for rules serialization/validation and evaluation behavior. |
…ate_playlist, genre filter
|
The Dependency Security Check CI failure is not caused by this PR.
There is currently no open PR to fix this. A separate PR targeting |
…nload cleanup, OR-logic bug fix, fetch_limit cap
…eview limit clamp, fetch cap, year range validation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Detailed how-to-use guidance lives in _demo_plugin_provider's commented stubs; the base class methods only need a one-line summary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Originally added for a soft-validation warning at provider load that was scoped out of the plan. No callers remained. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…fallback The dispatch helper returns the full ProviderInstanceType union; an isinstance check on (MetadataProvider, PluginProvider) lets mypy verify the get_similar_tracks/get_similar_artists call without suppressions and is also runtime-defensive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The dispatch helper's priority filter already guarantees the runtime type, so the isinstance branch was redundant. cast inside the try makes the invariant explicit without an extra runtime check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the style of _demo_music_provider: real method signatures with docstrings + inline guidance, returning empty results. Easier for plugin authors to copy/paste than commented-out blocks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… items Plugins surfacing playlists via browse/recommendations need their items fetchable via the standard MediaControllerBase.get_provider_item path. Previously the controller hard-cast every provider to MusicProvider and called provider.get_item, which doesn't exist on PluginProvider. - Add PluginProvider.get_item dispatcher (PLAYLIST -> get_playlist for now). - Widen the cast in MediaControllerBase.get_provider_item to MusicProvider | PluginProvider. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…uginProvider gains BROWSE/RECOMMENDATIONS/SIMILAR_TRACKS support
Smart Playlist Plugin
A new plugin provider that enables smart (rule-based) playlists in Music Assistant.
Features
SIMILAR_TRACKS(e.g. Apple Music, Spotify)[Smart Playlist] ...create,update_rules,get_rules,list,generate,count_tracks,preview_tracksSeed track behaviour
When a seed track URI is set:
artist_ids/album_idsare ignored (incompatible with similar-track lookup)