Need to used XMBC python library with OSMC image on RasPi (or an alternative?)

I’ve got OSMC installed and have root access. I’m trying to run a script on startup that will automatically start a playlist of videos, the code is as follows. Very simple

import xbmc

However when ran it gives the error:

ImportError: No module named xbmc

So basically I need the XBMC library or I need to find an alternative solution. Any suggestions are appreciated!

Maybe a dumb answer, but have you tried replacing xbmc with kodi?

import kodi

import xbmc only works when the script is run from Kodi directly

Make sure it’s directly run, and you aren’t calling another script with this import

Create a service addon for kodi. Or more simply, install a service addon from the kodi repo (one you don’t want to use) and replace the contents of the file with your three lines.

1 Like

Thank you! Then is there a way to run the service addon during startup?
Edit: its too early… I now realize a service addon already means that it runs during startup. Ill try it out!

Thanks for the tip Karnage! Got it running on a service I didn’t want to use then I just created my own.

It runs on startup after sitting on the homescreen for a second or two, is this normal? I was really hoping it would go straight from boot screen to video. Just something slightly annoying I wish I could fix

Services run after kodi begins, the few seconds on the home screen is unavoidable.

You could just delete the home screen, so nothing will show. Find the relevant Home.xml file for the skin you are using and remove the contents, or maybe the contents within the first node. (After making a backup copy, of course.)


Another way would be to use a minimal raspbian image with omxplayer.
Would mean faster boottimes and no kodi needs to be loaded.

1 Like

Hmm omxplayer seems like it may make my job a little easier, thanks for the recommendation. Will definitely keep it in mind