Startup scripts, where, how

I run Kiosks at a few malls. I have installed stand alone osmc-p2 on a Pi2 and have it working great. I am running a recursive slideshow that includes pictures and videos and it does exactly what I want it to do. I have a thumb drive with the slides and videos that I can take home and update as needed. my problem is my employees can’t seem to figure out how to get it started. I have to talk them through it every night. I need a script or something that will start the slideshow from a directory on the thumb drive on boot. I have seen this topic covered on the net but it seems like the answers are for earlier versions because I don’t have the files and directories they discuss. I’m not sure of the boot process with this software and don’t know how to modify the osmc start up. Any help would be appreciated.

Here is an empty structure for a Kodi addon: GitHub - KODeKarnage/script.skeleton

To tell Kodi to run it on startup you need to change this line in the addon.xml from this:

<extension point="xbmc.python.script" library="default.py"> </extension>

to this

<extension point="xbmc.service" library="default.py" start="login"></extension>

Then you can put your code into the default.py file and it will be run on startup.

This would be the very basics to get a slideshow to play:

import json
import xbmc

IMAGE_FOLDER = '/home/osmc/your_image_folder/'

if __name__ == "__main__":
	query = {"jsonrpc": "2.0","id": 1, "method": "Player.Open", "params": {"item":{"directory": IMAGE_FOLDER}, "options": {"repeat": "all", "shuffled": True}}}
	xbmc_request = json.dumps(query)
	xbmc.executeJSONRPC(xbmc_request)

Changing between images and videos would require more work.

1 Like

How about running a built in function. The one I was thinking of is RecursiveSlideShow(dir). That would do what I need.

Oh another question before a single word of thanks for providing your business with 95% of the solution you were looking for.

Let me get right on that.

Yes you are correct thank you for your help. I wasn’t able to do much with it. I decided to go back to square one with this and try to figure out how Kobi handles addons. I found a tutorial for a hello world addon and I have been trying to get that to run. The code itself isn’t the problem as much as how to get Kobi to recognize its there. Between reading old outdated wikis and having the information be for other operating systems with a different directory structure it is slow going. I can install an addon from the repository, but Kobi refuses to see anything I write. Again thank you for taking the time to provide an answer to my original question even though the answer was way over my head.

So your basicly not paying attention the script that karnage linked was a simple hello world script but hey if you dont wanna listen then its hard to help you. :slight_smile: good luck on your endevour

ps. its Kodi not Kobi