Remote: Start a film on XBMC (on Raspberry) using a Python Script
#1
Welcome everyone, I am new to this forum and new to XBMC and Python as well.

I am working on a projekt right now, to realise different remote stuff on the XBMC, using python scripts.

Things I already did:
  • I wrote addons with python (which i need to start manually in xbmc), to start a selected film/music.
  • I wrote a python script (using pysftp), to search for all the data in a specific directory. (videos/music/pictures)
  • I wrote a python script (using pysftp), to upload data in a specific directory. (videos/music/pictures)
  • I wrote a python script (using pysftp), to download data from a specific directory. (videos/music/pictures)

The next (and maybe most important) step, would be, to start videos/music on the xbmc, by using a python script running on a windows computer (remote).
Also I need to set a time, when the video should start.


It is no problem to start a file from the xbmc on my windows computer by using pysftp.
But I have no idea to do it in the other direction Sad
The film needs to run on the raspberry (xbmc) and not on the windows computer, but I need to start this film from the windows computer...

My only thought is, to write a python addon, where I can select which film should start at which time.
This would not be a problem i think.
But the problem is, this addon needs to be saved in the xbmc, but I need to start this addon via a python script on my windows computer.

My question, is there a way to do that?
Or is there another option to get this running?




This is a projekt for school and pretty important and I would really, really appreciate some help.


Best regards,

Stuckili Smile
Reply
#2
I'm no python dev, but calling JSONrpc on the PI from python on Win should work. And note that you have to allow remote control of Kodi from other devices in settings. You could probably also use the UPNP "play to" feature.
Reply
#3
da-anda's right. This should be very easy from a python script using the JSON RPC interface.

There's a python module created by a user on this forum to simplify using JSON (I've tweaked it slightly: https://github.com/elParaguayo/python-xb...bmcjson.py).

Starting a movie etc should then be fairly easy:
Code:
from xbmcjson import XBMC

myxbmc = XBMC("http://address.of.your.raspberrypi:8080/jsonrpc") #assumes no password set

params = {"item":{"file":"/path/to/file/here"}}}
myxbmc.Player.Open(params)

Can't test at the moment but happy to help if you have any questions.

EDIT: I hope your school project was not to learn how to write the code yourself!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
Thanks for your help!

You gave me good tips to work with, this is exactly what i was looking for Smile


My project is more about the xbmc part and less about Python and my teacher told me to use the internet, if I struggle somewhere, so it is all good Big Grin


And thanks again
Reply
#5
No problem. If you need any more help then come back and ask.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
Remote: Start a film on XBMC (on Raspberry) using a Python Script0