Picture addon problems
#1
Hi!

I'm pretty new to the Kodi Addon business so please excuse any questions considered obvious.

I wrote a small picture plugin and some problems arose. Maybe you can help me and provide some links/pointers.

1. In the deepest view, I have ListItems that directly point to an external URL (path=url) that holds an image file (JPG). Now, if I click on one of them the view is _not_ changed and the image is _not_ "played", i.e., shown in full size. I've tried setProperty("IsPlayable", "true"), I do setInfo(type="image", infoLabels={"FileName": item.label}) and <provides>image</provides> but still the image won't be displayed full size. Am I missing something, potentially essential? Do I have to use setResolvedUrl()?
2. The external images I load are not that small and I realized it would be good if I start to cache them. First of all, is there a Kodi-builtin _magic_ I can trigger to cache the external images (their URLs do not change)? If not, is it valid to rely on other plugins like, e.g., script.common.plugin.cache, or should I use plain xbmcvfs and open/write?
3. Is it considered good practice to use Kodi plugin "routing" (script.module.routing), or should I stick to do the routing manually?

Thanks for your opinions.
Reply
#2
4. Is it possible to somehow get this nice preview for pictures _inside_ a folder? (When browsing through folders that contain pictures/images ("picture view") folders do not show thumbnail icons but a mashup of some of the pictures inside that folder)
Reply
#3
(2019-05-16, 12:37)whitedwarf Wrote: folders do not show thumbnail icons but a mashup of some of the pictures inside that folder)
Context Menu on the folder, the select Choose Thumbnail
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#4
1. hard to tell why it doesn't work for you without seeing any code.
picture addons can be pretty basic and not much is needed to view images full-screen.
a basic example:
python:
    fileurl = 'https://elmicrolector.files.wordpress.com/2016/10/breu-14-a1.jpg'
    li = xbmcgui.ListItem('pic1')
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=fileurl, listitem=li)

2. caching is handled by kodi out of the box.
i tested with the code above and the image ends up in the texture cache of kodi

3. whatever you prefer, there's no right or wrong.

4. nope, it's not really possible for plugins to recreate the standard folder thumbs kodi generates in the pictures section.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
(2019-05-16, 22:01)ronie Wrote: 1. hard to tell why it doesn't work for you without seeing any code.
picture addons can be pretty basic and not much is needed to view images full-screen.
a basic example:
python:
    fileurl = 'https://elmicrolector.files.wordpress.com/2016/10/breu-14-a1.jpg'
    li = xbmcgui.ListItem('pic1')
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=fileurl, listitem=li)

2. caching is handled by kodi out of the box.
i tested with the code above and the image ends up in the texture cache of kodi

3. whatever you prefer, there's no right or wrong.

4. nope, it's not really possible for plugins to recreate the standard folder thumbs kodi generates in the pictures section.
1. Finally, it works. And thanks for your code snippet, it gave me a crucial hint. I kind of ignored the specifics of the URL I use but when I read the snippet I stumbled upon .jpg. Apparently Kodi is not using HEAD to determine the Content-Type of the URL but merely looks for the _extension_ in the URL (ignoring any query string). So I changed the server-side API to read /photo/get/<id>.jpg and now Kodi opens the images as expected. (This behaviour _is_ a little bit surprising though because Kodi uses _a lot_ of HEADs when building a directory listing.)

2. With the API and URL changes described above, I can now see the builtin caching working.

3. Ok.

4. What a pity. Would have loved to have this as it spices up directory views significantly.
Reply

Logout Mark Read Team Forum Stats Members Help
Picture addon problems0