2019-09-28, 22:01
Greetings!
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:
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!
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:
Code:
# -*- 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/alligator-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):
try:
with open("/tmp/kodi.diag", "ab") as fobj:
fobj.write(time.ctime() + " Params: " + " ".join(argv) + "\n")
except:
pass
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!