(2024-07-10, 17:13)GiovanniG11 Wrote: thanks for replying, to avoid any possible confusion I?m just talking about images, open a image only directory will produce the same order, even if the random button is activated, I suppose it is a bug.
No playlist, just open the folder as described with code before, and I noticed that start slideshow from inferface directly also has no randomize, so it's not working at all
Do you now another way to give a random order? How JSON-RPC_API/v13 anc help me in such issue? THere is something I can send to activate the random order while they are playng?
Telling you the truth, I don't like this guide, I can't figere out how can I use the code they wrote, it's different from the one that I use and works, I don't understand nothing there, sincerely. More, I've found there command Input.Action which doesn't work, while Input.ExecuteAction (which is not described) works.
In the Mezzmo Kodi addon I wrote my own slideshow viewer which can handle manual slides, timed slowshows and more.
Here's the code. It creates a background window to catch keystrokes for forward, back, pause, resume etc. Loading the slides themselves is in lines 849-905 for the timed slideshow It loads a list of images in this case a list of URLs called piclist) and directly displays the images. It doesn't use JSON RPC.
I did previously use JSON RPC to load the list and cycle through the images. Here's the code:
JSON RPC slideshow:
def ShowSlides(piclist, slidetime, ssmode): # Slidehow viewer
try:
kbmonitor = KodiMonitor()
slideIdx = 0
#xbmc.log('Mezzmo picture url is: ' + str(playitem) , xbmc.LOGINFO)
xbmc.executebuiltin('Dialog.Close(all, true)')
while slideIdx < len(piclist):
if kbmonitor.flag == 'play':
playitem = picURL(piclist[slideIdx]['url']) # Verify proper file name
#xbmc.log('Mezzmo picture index is: ' + str(playitem) , xbmc.LOGINFO)
json_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Player.Open", \
"params":{"item":{"file":%s }},"id":1}' % (playitem))
#xbmc.log('Mezzmo picture dictionary list is: ' + str(piclist) , xbmc.LOGINFO)
slideIdx += 1
xbmc.sleep(slidetime * 1000)
if slideIdx == len(piclist) and ssmode == 'yes': # Continuous slideshow
slideIdx = 0
#xbmc.log('Mezzmo monitor data is: ' + (kbmonitor.flag) , xbmc.LOGINFO)
if kbmonitor.flag == 'stop':
del kbmonitor
xbmc.executebuiltin('Dialog.Close(all, true)')
return
break
if kbmonitor.flag == 'pause':
slideIdx = slideIdx
xbmc.executebuiltin('Action(ParentDir)')
del kbmonitor
except Exception as e:
printexception()
mgenlog = 'Mezzmo error displaying slides.'
xbmc.log(mgenlog, xbmc.LOGINFO)
mgenlogUpdate(mgenlog)
The kbmonitor stuff can be deleted because that was for stop, pause and resume. If you want that class code I can provide it. To randomize the slides you can just randomize the slideIdx number prior to the JSON RPC call.
I hope this helps.
Jeff