Hallo,
ich habe gerade das wohl kürzeste Plugin der Welt geschrieben und in github eingecheckt.
Gut man hätte es noch kürzer machen können, aber ich will es ja noch erweitern. Momentan kann man damit nur Meldungen an XBMC schicken.
Edit: Ach ja, in XMBC muss man unter System-Settings-Service "Allow programs on other systems to control XBMC" aktivieren.
Bis bald
Marcus
ich habe gerade das wohl kürzeste Plugin der Welt geschrieben und in github eingecheckt.

Code:
#!/usr/bin/env python
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
import logging
import json
logger = logging.getLogger('')
import lib.my_asynchat
class XBMC(lib.my_asynchat.AsynChat):
_notification_time = 10000
def __init__(self, smarthome, host, port=9090):
lib.my_asynchat.AsynChat.__init__(self, smarthome, host, port)
self._sh = smarthome
smarthome.monitor_connection(self)
self._id = 0
def run(self):
self.alive = True
def _send(self, method, params):
self._id += 1
data = {"jsonrpc": "2.0", "id": self._id, "method": method, 'params': params}
self.push(json.dumps(data, separators=(',',':')))
def notify(self, title, message):
self._send('GUI.ShowNotification', {'title': title, 'message': message, 'displaytime': self._notification_time})
def stop(self):
self.alive = False
Code:
#etc/plugin.conf
[xbmc]
class_name = XBMC
class_path = plugins.xbmc
host = X.X.X.X
Code:
#logic/xb.py
sh.xbmc.notify('hello, 'world')
Bis bald
Marcus


Kommentar