Skip to content

Conversation

@MonkeyDo
Copy link
Member

@MonkeyDo MonkeyDo commented Oct 8, 2025

A user on Mastodon was looking for a way to export their playlists, and someone recommended Soundiiz.
Since XSPF is a playlist interchange format (that we support exporting to), we should have a way to support importing XSPF playlists.

I refactored the existing playlist file import modal to support XSPF, parsing the file client-side with the xspf-js library before sending a JSPF document to the server.

Unfortunately, currently upon playlist creation, every track's identifier field must be a MusicBrainz recording URL, making is less useful for the use-case described above (we can still import our own exported playlist xspf file).
We should think about allowing importing JSPF with identifiers other than MB recordings, especially if it is an identifier we can potentially use for metadata, for example a Spotify URL (https://soundiiz.com/tutorial/export-spotify-to-xspf).

Also added a checkbox to make the playlist private, as we need to set that to a value before sending the JSPF to the server, for some reason.

UI screenshot to show the improved validation error messages:
image

Parse XSPF files on the flhy in the front-end, then send a JSPF object like we do for JSPF files.

Added validation feedback using react-bootstrap because why not?
@MonkeyDo MonkeyDo changed the title Import XSPF playlist files LB-1853: Import XSPF playlist files Oct 8, 2025
@mayhem
Copy link
Member

mayhem commented Oct 8, 2025

You're doing it 'rong. Use the troi resolve playlist feature for this exact purpose.

@MonkeyDo
Copy link
Member Author

MonkeyDo commented Oct 9, 2025

You're doing it 'rong. Use the troi resolve playlist feature for this exact purpose.

OK, that was my hunch, but I need more guidance than that as I haven't used troi.

One issueI am facing is that sending a playlist exported from another service to the create_playlist endpoint returns an error as the validation function expects MB recording URLs as each track's identifier.

So my options as far as I understand are:

  1. modify the validate_playlist function to allow for non-MB identifiers (maybe with a flag sent in the create_playlist endpoint request?), then use troi to resolve the tracks to MB recordings as part of the playlist creation process.
  2. Create another endpoint that will resolve JSPF tracks to MB recordings, call that from the front-end then once resolved send the playlist to the create_playlist endpoint.

I think #1 makes more sense to me.

In any case, I would still appreciate some guidance in how to use troi.
In some cases, the existing identifiers from the exported playlists will contain URIs to music services that LB supports, so we could potentially use existing methods to resolve recordings from, say, spotify URLs in the playlist.
I see for example I could pair Spotipy's tracks method to get the tracks from Spotify, then pass those to the mbid_mapping_tracks function.
Should these new functions (parse identifiers to match a music service, get tracks from music service) be part of a new patch? Or just functions exported from troi?

@mayhem
Copy link
Member

mayhem commented Oct 9, 2025

I think we should have a larger planning discussion on this feature. I really hope to return to the office next week -- can we do it then?

@MonkeyDo
Copy link
Member Author

MonkeyDo commented Oct 9, 2025

I think we should have a larger planning discussion on this feature. I really hope to return to the office next week -- can we do it then?

Absolutely!
I agree this will be easier in person, there is so much I don't know about troi that being able to go through it all with you will be necessary.
No problem with waiting until you are feeling better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants