picture plugin question: how to display the picture from an image URL?

I followed https://github.com/romanvm/plugin.video.example to learn to create a  video plugin, and now working on creating a picture plugin. picture_list is the list of pictures, and I'd like to have the images fetched and displayed as a slideshow. Here's the code I've so far:


# -*- coding: utf-8 -*-
# Module: default
# let's figure this out!
import sys
from urllib import urlencode
from urlparse import parse_qsl
import xbmcgui
import xbmcplugin
import time
import requests
import random
myReq = requests.Session()
picture_list = ["https://www.vidsplay.com/wp-content/uploads/2017/04/crab-screenshot.jpg",
                'http://www.vidsplay.com/wp-content/uploads/2017/04/turtle-screenshot.jpg' ]
_handle = int(sys.argv[1])
def play_video(path):
    Play a video by the provided path.
    :param path: Fully-qualified video URL
    :type path: str
    logString("fnname play_video")
    # Create a playable item with a path to play.
    play_item = xbmcgui.ListItem(path=path)
    # Pass the item to the Kodi player.
    xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
def logString(*argv):
        with open("/tmp/kodi.diag", "ab") as fobj:
            fobj.write(time.ctime() + " Params: " + " ".join(argv) + "\n")
if __name__ == '__main__':
    logString("We are evoked with {args}".format(args= " ".join(sys.argv)))
    logString("handle is {X}".format(X=_handle))
    thisArg = sys.argv[2][1:]
    if not thisArg:
        xbmcplugin.setContent(_handle, 'images')
    for i in range(3):
        dialog = xbmcgui.Dialog()
        dialog.ok('Kodi', 'How to display', picture_list)

I am able to display the URLs using xbmcgui.Dialog().ok(), https://evuraan.info/screenshots/images/kodi-pic.png shows where I am at.  If this is the right approach how can I further display the actual image on the screen?

Any help would be much appreciated, thanks!

Answering my own question

    for i in range(5):
        #dialog = xbmcgui.Dialog()
        #dialog.ok('Kodi', 'How to display this image?', picture_list)
        pic = picture_list
[i]        label = pic.split("/")[-1]
        if "thumb" in pic or "sized" in label:
        url = Base + picture_list
[i]        Head = myReq.head(url)
        if not Head.ok:
        li = xbmcgui.ListItem(label=label, thumbnailImage=url)
        li.setInfo(type='image', infoLabels={'Title': pic})
            url = url,

A good reference point: https://github.com/idleloop-github/scrip.../plugin.py[/i][/i]
I tried the same, but with the XBMCSourcePlugin:
If it create the directory item:

plugin = XBMCSourcePlugin()


        plugin.addDirectoryItem(url=thumb+"|"+cookies, listitem=listitem,  isFolder=False)
Where the thumb is the whole url for the image with query string:
and the cookies is the cookies for the request.
The item is showing but after the select do nothing (I hear the sound). I pass thru an debug proxy, and not even call the url.

If I change the url to inner call and created a new function to show the image:

is working.
(with this solution I have many problem:
1, cant go to the next picture
2, i'd like to use the plugin.getSetting('server'), but in this case (only in this case) give back nothing, look like need somewhere an extra parameter?)

thanks for any help

Logout Mark Read Team Forum Stats Members Help
picture plugin question: how to display the picture from an image URL?0
This forum uses Lukasz Tkacz MyBB addons.