-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add M3U library provider #2156
Add M3U library provider #2156
Conversation
Library provider is used by the core.tracklist.add method. Adding the provider allows m3u uris to be used with core.tracklist.add
I've always struggled with what to do with this and previously come to the conclusion the two step approach is best. And it's what other clients do - you can add multiple uris to the tracklist at a time so it's not a big deal. This is because M3u playlists are a bit weird in that they contain tracks from other backends. |
I think for this to work properly we'd need EDIT: actually, I don't think this works. See #2156 (comment) |
Ah you're right. My motivation for being able to add the entire playlist with one URI is because it's not trivial in Home Assistant to capture, format, and use the response from one API call as the body for another. I want to be able to send a request that does Regarding the two step approach: I do think it would be valuable for any part of the codebase to be able to identify when a track is URI only vs when a track is populated with all the expected metadata. I can think of a few ways to go about it:
I think it makes more sense for the backend to carry the responsibility of populating the tracks it returns than for all of the call sites to handle Anyways, that's just my opinion on the approach, but I appreciate that I do not have nearly as much context as yourself and others. I'm happy to iterate on the approach and implement the change once decided. |
Option 2 isn't compatible with our https://docs.mopidy.com/stable/api/architecture/#architecture, backends cannot call into core (or other backends). Doing so would create loops in the graph, that's a lot of complexity. I don't think we'd ever go down that route. |
My option 3 to change
Option 4 could be for The unavoidable and weird skeleton M3U tracks issue has been bugging me for years. I really like that option 4 might solve everything. It does mean a bunch of API changes but the good news is that now is a great time to make them! Am I mad? Any thoughts @jodal ?
Ideally, a |
That all sounds reasonable to me! Just to make sure I'm understanding your approach:
Is that correct? |
Yes, that's a much clearer version of my waffle! It also needs something (a default implementation?) that allows calling the new identify/mapper API to still work for old backends that don't implement it yet. But I'd like some more comments before we actually take this further because maybe there's a better approach. It's a fair bit of work. I think it's worth it but there's a risk I've got my blinkers on. |
Agreed! Once jodal and whoever else chime in I'm happy to start. |
I think this might work, but I've only had a careful read through this thread while on the move, so I haven't cross-checked with code yet. The msgspec PR actually adds a Either way, I think the crux is if we can do all this in a way that doesn't require all existing extensions to be patched. |
It would be nice to reuse the new If the general approach sounds good I can put together a PR that we can iterate on. |
I think a default implementation returning refType Track would be OK since it would then retain existing behaviour (pass it to I thought about it some more yesterday and I'm confident we can keep existing behaviour for old extensions. I was planning on splitting this up into two issues ( |
Sounds good! I will put together something soon with what I'm thinking. |
Library provider is used by the core.tracklist.add method. Adding the provider allows m3u uris to be used with core.tracklist.add. Without it one cannot add a m3u playlist in one action and would instead have to list all the items then add them one at a time.
Resolves #2155