Skip to content
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

Consider using uri_prefix instead of uri_scheme for backend delegation #696

Open
adamcik opened this issue Feb 17, 2014 · 10 comments
Open
Assignees
Labels
A-core Area: Core layer C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal

Comments

@adamcik
Copy link
Member

adamcik commented Feb 17, 2014

Would allow for things like soundcloud mathcing http://soundcloud.com things and handling them instead of stream, which would just be a fallback. We could also just have a generic fallback where if nothing claims it we simply give it to audio and hope for the best.

@dz0ny
Copy link
Contributor

dz0ny commented Feb 18, 2014

👍

@txomon
Copy link
Member

txomon commented Feb 25, 2014

Supporting both is too nut? I mean, at the end is to match both of them against the begining of a string, isn't it?

@adamcik
Copy link
Member Author

adamcik commented Feb 25, 2014

There is a bit more to it when multiple backends can service the same request. Either first one in order that returns a non empty list wins, or we have the first one that returns a list win, returning None for the I don't know case. So this needs to make those changes in core + test changes.

@adamcik
Copy link
Member Author

adamcik commented Jun 20, 2014

@tkem - any thoughts how a uri like podcast+http://www.example.com/mypodcast.rss should be parsed. One approach I've seen is treating it like scheme = podcast and then considering the stuff after the plus like a localpart similar to how you would in mail.

@tkem
Copy link
Member

tkem commented Jun 20, 2014

According to RFC3986, + is a valid scheme character, so the scheme would be podcast+http.

@jodal jodal added this to the Core cleanup milestone Jun 22, 2014
@adamcik
Copy link
Member Author

adamcik commented Jul 26, 2014

This could also be done more along the lines of an routing system (think web apps) or a rewrite system. The latter would simply be a hook that allows backend to rewrite URIs before the regular URI handling kicks in.

@adamcik
Copy link
Member Author

adamcik commented Aug 1, 2014

Idea just came up on IRC that dz0ny's mopidy android app could have intents registered for the extensions we support, so in that case we would need to make this into something that can at least map to android's intent filtering or just outright mimic it.

@jodal jodal modified the milestones: v0.20 - Audio cleanup part 1, v1.0 - Core cleanup Feb 5, 2015
@jodal jodal added the 1 - Ready label Feb 5, 2015
@jodal
Copy link
Member

jodal commented Feb 5, 2015

The plan is to implement core.get_uri_prefixes() right now and remove core.get_uri_schemes() in v1.0.

@adamcik adamcik modified the milestones: v0.21 - Gapless playback, v0.20 - Audio cleanup 1 Mar 13, 2015
@jodal jodal modified the milestones: v1.0 - Audio cleanup 1, v1.1 - Gapless playback Mar 18, 2015
@jodal jodal modified the milestones: v1.0 - Audio cleanup 1, v1.1 - Gapless playback Mar 18, 2015
@adamcik adamcik modified the milestones: v1.2 - Gapless, v1.1 - Robust core Apr 26, 2015
@jodal jodal modified the milestones: v1.2 - Gapless and GStreamer 1.x, v1.3 - The rest of v1.2 Jan 17, 2016
@jodal jodal removed this from the v1.2 - Gapless and GStreamer 1.x milestone Jan 17, 2016
@jodal jodal removed the 0 - Backlog label Mar 26, 2016
@jodal jodal modified the milestones: v2.1 - The rest of v2.0, v2.2 - The rest of v2.1 Oct 24, 2016
@jodal jodal removed this from the v2.2 milestone Mar 31, 2018
@adamcik
Copy link
Member Author

adamcik commented Jan 2, 2020

I've been thinking over this based on the somafm bug I commented on. I think we want to allow backends to pass on answering things about prefixes they've claimed. This would allow things like having an extension handling library methods like get_images, but ignoring playback ones like translate_uri. This would be needed as long as we have the prefixes at the backend level, and not on each provider.

This would be fairly simple to do for single URIs, just get a list of backends and try them one by one until one does not pass. For cases with multiple URIs it gets more complicated, at least the way I'm imagining things, i.e. we would need to make sure the semantics are simple enough.

Trying to write this all out I realized we can probably get away with a simpler approach, we pick the backend with the longest prefix match and a provider of the right type. With this change things like somafm would work as they don't have a playback provider, so we would fallback to stream, while still using somafm for library calls.

@adamcik adamcik self-assigned this Jan 4, 2020
@adamcik
Copy link
Member Author

adamcik commented Jan 4, 2020

Started adding a helper for prefix matching, and will try with the simplest thing we can get away with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core layer C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal
Projects
None yet
Development

No branches or pull requests

5 participants