Create Services for Playlist Export / Import with options#3387
Draft
chrisuthe wants to merge 17 commits intomusic-assistant:devfrom
Draft
Create Services for Playlist Export / Import with options#3387chrisuthe wants to merge 17 commits intomusic-assistant:devfrom
chrisuthe wants to merge 17 commits intomusic-assistant:devfrom
Conversation
Allow callers to opt-in to resolving track metadata (artist, title, duration) as EXTINF lines in M3U export. Defaults to False for fast bare-URI exports; radios always include EXTINF regardless.
When importing an M3U playlist with library_matching=True, tracks whose provider is unavailable are searched across all providers using EXTINF metadata (artist, title, duration). Adds parse_extinf_title helper, _match_track_by_metadata/_score_track_match to builtin provider, and passes the optional parameter through the controller API.
Add replace_playlist_track to builtin provider and playlist controller for in-place remapping of unresolvable tracks after import. Add scoring integration tests for the library matching logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows import/export of MA playlists and radio stations, separately. Export includes an option to export basic data (for URI matching) or EXTINF metadata for "Library Matching" which is an option on import. Library matching uses the EXTINF to attempt to search & match items somewhere in your library. Great for re-adding your library or transferring from one MA user to another. Also added is the ability replace a playlist track with a single call for an eventual UX of "Manual match" scenario.
I asked AI to create a quick page to test this functionality with since I don't think I'll be the person to implement the UI for it, it's available here: https://gist.github.com/chrisuthe/387180c78b8b12ae12b6659c814fa7d2 just save it locally and pop it open for testing.
New API Commands
music/playlists/export_playlistdb_playlist_id,include_track_metadata(optional, defaultfalse)include_track_metadata=true, emits#EXTINF(artist, title, duration) and#EXTMA(ISRC, MusicBrainz Recording ID, album, podcast, authors, media type, provider domain) lines.music/playlists/import_playlistm3u_data,library_matching(optional, defaultfalse)library_matching=true, searches all providers to resolve unmatched URIs using a tiered matching strategy:music/playlists/replace_playlist_trackdb_playlist_id,position(1-based),new_urimusic/radio/export_radios#EXTINFand#EXTMAmetadata.music/radio/import_radiosm3u_dataM3U Format Extension
Uses a custom
#EXTMA:comment line (ignored by standard M3U players) to carry structured metadata:Supported fields:
isrc,mbid,album,media_type,provider,podcast,authors,narratorsHow Matching Works
When
library_matching=true, each track whose URI can't resolve (provider not available) is searched across all available providers. Each search result is scored, and the highest-scoring result across all providers wins. If an ISRC or MusicBrainz ID matches (score 10), it returns immediately without searching further providers.A score of 0 means "not a match" — the candidate is rejected. Any score > 0 is a valid match candidate. The highest score wins. If no candidates score > 0, the original (unresolvable) URI is kept in the playlist and counted as "unmatched" in the import log.