Kodi Community Forum
Using OAuth URLs for thumbnails - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Using OAuth URLs for thumbnails (/showthread.php?tid=170152)



Using OAuth URLs for thumbnails - EDevil - 2013-07-30

Hello.

I'm writing an addon that interfaces with an OAuth API. This API allows me to list and download videos, and also to obtain their thumbnails.

While populating ListItems I was thinking of supplying XBMC with pre-authed URLs as the 'thumbnail' attribute, but it seems XBMC does multiple requests to this resource (HEAD, followed by two GETs). Since OAuth authorizations carry a nonce, after the first request all the others will fail.

What would be the best approach to solve this issue? I was thinking of downloading all the thumbs of that page and supply local file:// URLs, but loading all the thumbs is a slow process to do before rendering the page. Also, where would I store all these thumbnails?

Thanks for the help.


RE: Using OAuth URLs for thumbnails - sphere - 2013-07-31

Let me quote my reply from the other thread, here is a better place for that discussion:

(2013-07-31, 21:12)sphere Wrote:
(2013-07-31, 18:43)EDevil Wrote: Some async mechanism to supply the URL both in the "thumbnail" attribute of a ListItem and in the "path" attribute when listing a SlideShow would be perfect.

This is already possible.
In Detail:
- You can use setResolvedUrl() for the path which is async (your plugin will be called to retrieve the playpath when needed).
- You can write an image plugin and use its plugin url as slideshow path (combine with above).

But anyway, its sad that there is no real progress on 27/30 api wishes.



RE: Using OAuth URLs for thumbnails - EDevil - 2013-08-01

I already use a "plugin://" URL that uses setResolvedUrl() on the "path" attribute of ListItems in the video and audio components of my addon. Both contents play fine. It is only in the images component that setResolvedUrl with "plugin://" paths is not supported.

You suggested writing a custom Image plugin that would do the slideshow instead of using the builtin slideshow? How hard would this be? Is there some other plugin I can use as an example? This is my first plugin so please bear with me...

Would this enable me to use "plugin://" URLs in the "thumbnail" component of ListItems?

Thanks for the help!


RE: Using OAuth URLs for thumbnails - sphere - 2013-08-01

(2013-08-01, 10:04)EDevil Wrote: I already use a "plugin://" URL that uses setResolvedUrl() on the "path" attribute of ListItems in the video and audio components of my addon. Both contents play fine. It is only in the images component that setResolvedUrl with "plugin://" paths is not supported.

You suggested writing a custom Image plugin that would do the slideshow instead of using the builtin slideshow? How hard would this be? Is there some other plugin I can use as an example? This is my first plugin so please bare with me...

Would this enable me to use "plugin://" URLs in the "thumbnail" component of ListItems?

Thanks for the help!

The plugin VFS (URLs with "plugin://") only gets resolved on ListItems path (not in thumbnail or iconImage).

But you can start a (builtin) slideshow to a plugin VFS where you expose a bunch of listitems with each pointing to plugin VFS single listitem which uses setResolvedUrl to return its path async. So this way only works for slideshows on an image plugin.


RE: Using OAuth URLs for thumbnails - EDevil - 2013-08-01

I have tried to do what you suggest. What ended up happening was that when I click on a picture, which should start the SlideShow functionality, I get an empty list.

This is my code: https://github.com/edevil/CloudPTXBMC/blob/AsyncImage/plugin.video.cloudptxbmc/addon.py#L90

So, browse_image() builds lists of ListItem with paths of type "plugin://". These paths point to show_image() which immediately returns a single ListItem with setResolvedUrl(). Is this not it?


RE: Using OAuth URLs for thumbnails - sphere - 2013-08-01

I tried it myself and you are right - it doesn't work!
Either I am wrong or it worked some time ago.

Sorry.