Kodi Community Forum

Full Version: uri2addon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
I know there are URLresolver and youtube-dl, but these two addons have (just my opinion) some design flaws if it comes to extensibility. But I don't want to go in details with these two addons. They have the right to be there, but I hope we can do better.

I first realized the problem as I developed the SoundCound addon. If you want to share a SoundCloud-URL from your phone or web-page, you get a normal URL, no ID or what so ever to use with the API of SoundCloud. So, there was no solution for Yatse to construct a valid plugin-uri for SoundCloud. After some talks with Tolriq we solved the problem - Yatse is sending the full url directly to the addon, the addon is resolving the URL into an ID and after that everything is working fine.

The newest adventure was this #248 on GitHub for YouTube, extending in this issue #176.

It seems KODI is missing some central endpoint on which addons can register for domains (like operating system work). For example take Android - apps can register for domains - so if I select a link for IMDB the IMDB app will open the link directly, not my browser - the same for YouTube and SoundCloud on my phone or Tablet.

So this is a test to use one addon, which will check for registered domains and call the corresponding addon(s) for the domain on an specified endpoint. The difference is, that the addons register the domains and not uri2addon. The developers of KORE or Yatse can more relax, because they don't have to know every addon on earth...even URLresolver hasn't to be updated. So if I create a new addon, I can just provide the domains supported by the addon and the sharing feature should work from every device or browser-extension immediately.
KODI should benefit from the easy extensibility.

I hope this illustrates simplified the purpose of the addon. uri2addon don't know any of the addons or what is supported or possible. The addons 'tell' uri2addon what is possible. For example the URLresolver has to know most of the endpoints of the addons and is more of a compendium of all addons, which means it's not really an addon-/plugin-system anymore.
Image

To test this, you need the script.uri2addon and YouTube 5.1.6~beta3 of my repository. After that you can call all youtube.com and (shortened) youtu.be urls to play videos and even resolve the playlist features.

Code:
plugin://script.uri2addon/play/?uri=[URL_ENCODED_URI]
Outside of casting videos, Not sure I understand the need for this...

Send2xbmc is a simpler solution, no?
(2015-06-06, 02:36)Lunatixz Wrote: [ -> ]Outside of casting videos, Not sure I understand the need for this...

Send2xbmc is a simpler solution, no?
No. But send2xbmc would benefit from this addon.
Send2xbmc has to convert www.YouTube.com/watch?v=ABCDEFG to plugin://plugin.video.youtube/play/?video_id=ABCDEFG

And this for every addon which send2xbmc wants to support. But what's with new addons?

With script.uri2addon/play/uri=www.YouTube.com/watch?v=ABCDEFG the addon checks which addon supports the domain and calls the corresponding addon afterwards. Simple factory pattern.
Its definitely interesting, kudos to the idea... I agree that android like "domains" could come in handy... Thanks
This is definitively what I was thinking about when I talked to you about my idea Smile

The only missing part that I can see is more or less the same problem as in Android, multiple addons can register the same domain.

In Android a popup menu shows up to select, from remote / scripts point of view a popup is not perfect as when no screen it's impossible to select due to no API to communicate with addons.
I'm not sure scripts in Kodi can show dialogs but I suppose it can, and maybe as android have an option define as default for next times and an button somewhere to reset associations.

For better future no real idea of how to handle that.
Seems really cool but I am thinking the same as tolriq

Scripts can show dialogs, so that should be possible.
Okay...I try to show a selection dialog if multiple addons match for one domain Smile
Or maybe a priority system in a simple xml file as a start or in each addons that users can modify with any text editor, I'm not sure the problem will be very frequent, but should be thought about before this things become famous Smile
(2015-06-06, 10:28)Tolriq Wrote: [ -> ]Or maybe a priority system in a simple xml file as a start or in each addons that users can modify with any text editor, I'm not sure the problem will be very frequent, but should be thought about before this things become famous Smile
You're right. At the moment for a prove of concept it's a simple textfile, but I've implemented a manager class around it, so we only have to update the internal structure Smile if we need more data per domain and addon.

What isn't quite working with the addon is to list the found addons which have registered for domains. I return a list of items but the items won't show. Maybe I configured the addon wrong. I would use these items afterwards in the uri2addon for further configuration if needed.

I try to provide an update on this today in the evening or tomorrow, but now I have to get ready for a festival near by Smile

Thanks for the thoughts and feedback so far.
There's no reason to hurry Smile

Just tell me when you need things tested from Yatse perspective.
This is actually an idea we also had in mind
Still planned ? Incompatible with this ? Smile

Any details to know if this long lasting need should be pushed or wait for an official thing ?
(2015-06-06, 02:49)bromix Wrote: [ -> ]With script.uri2addon/play/uri=www.YouTube.com/watch?v=ABCDEFG the addon checks which addon supports the domain and calls the corresponding addon afterwards. Simple factory pattern.

It can also look if URLresolver supports that domain? Meaning it is not the only, but one of the many addons your addon calls afterwards.

I made an addon for personal use which send the URL to urlresolver. plugin.video.add.link.to.urlresolver
Basically if URLresolver supports a domain. You will be able to call it like this. plugin://plugin.video.add.link.to.urlresolver/?url=[URL_ENCODED_URI] . You could use this?
(2015-06-06, 09:56)bromix Wrote: [ -> ]Okay...I try to show a selection dialog if multiple addons match for one domain Smile
Personally I think any dialogs should be optional... Some users don't want to be overloaded with prompts. Click a video, watch it play...
(2015-06-06, 17:24)Lunatixz Wrote: [ -> ]
(2015-06-06, 09:56)bromix Wrote: [ -> ]Okay...I try to show a selection dialog if multiple addons match for one domain Smile
Personally I think any dialogs should be optional... Some users don't want to be overloaded with prompts. Click a video, watch it play...

If we're going the domain route like android and other platforms are doing, we need that dialog imo. We should not decide what addon to use in case there are multiple ones available that can handle a playable URL as IMO that choice belongs to the users.
Pages: 1 2 3 4 5 6