Commit 1550393e authored by Oliver Wagner's avatar Oliver Wagner
Browse files

V0.4 - 2015-06-16 - owagner

  - Settings: MQTT broker address is now a text field and thus allows entering of hostnames
  - will now check whether the title information changes during progress
    checking, and will republish the "title" topic if a change was detected
  - increase progress publish rate to 20s (from 30s)
  - avoid "kodi2mqtt" as a name in the documentation and addon itself, and instead stick to "MQTT Adapter"
parent bd6c8143
......@@ -2,13 +2,13 @@ language: python
script: "echo Nothing to do"
before_deploy: "zip -r kodi2mqtt_addon.zip service.mqtt"
before_deploy: "zip -r mqtt_addon.zip service.mqtt"
deploy:
provider: releases
api_key:
secure: ngx8lgauODj+3ZHPb062piIHYfGwY3DHrbiEPMH87VYBzvUbRJo/JSVJn/JllULCGDHOXITb79D9dbLcpFW+j23abXmd86dfHeVPUFlhgH+VBXtNjmMV5jWdEDYmCIsVORf+dWq4Z5pQjX9GtCpVOUb9wfMF6mRdIgioWj0TsCM=
file: kodi2mqtt_addon.zip
file: mqtt_addon.zip
skip_cleanup: true
on:
repo: owagner/kodi2mqtt
......
kodi2mqtt
=========
MQTT addon for Kodi
===================
Written and (C) 2015 Oliver Wagner <owagner@tellerulam.com>
......@@ -8,7 +8,7 @@ kodi2mqtt
Overview
--------
kodi2mqtt is a Kodi addon which acts as an adapter between a Kodi media center instance and MQTT.
This is a Kodi addon which acts as an adapter between a Kodi media center instance and MQTT.
It publishes Kodi's playback state on MQTT topics, and provides remote control capability also via
messages to MQTT topics.
......@@ -29,7 +29,7 @@ Settings
--------
The addon has three settings:
* the MQTT broker's IP address (defaults to 127.0.0.1)
* the MQTT broker's host name or IP address (defaults to 127.0.0.1)
* the MQTT broker's port. This defaults to 1883, which is the MQTT standard port for unencrypted connections.
* the topic prefix which to use in all published and subscribed topics. Defaults to "kodi/".
......
......@@ -2,7 +2,7 @@ The kodi2mqtt addon is licensed under the terms of the MIT license:
The MIT License (MIT)
Copyright (c) 2015 Oliver Wagner
Copyright (c) 2015 Oliver Wagner <owagner@tellerulam.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.mqtt" name="MQTT Adapter" version="0.3" provider-name="owagner">
<addon id="service.mqtt" name="MQTT Adapter" version="0.4" provider-name="owagner">
<requires>
<import addon="xbmc.python" version="2.19.0"/>
</requires>
......@@ -15,4 +15,4 @@
<email></email>
<source>https://github.com/owagner/kodi2mqtt</source>
</extension>
</addon>
\ No newline at end of file
</addon>
V0.4 - 2015-06-16 - owagner
- Settings: MQTT broker address is now a text field and thus allows entering of hostnames
- will now check whether the title information changes during progress
checking, and will republish the "title" topic if a change was detected
- increase progress publish rate to 20s (from 30s)
- avoid "kodi2mqtt" as a name in the documentation and addon itself, and instead stick to "MQTT Adapter"
V0.3 - 2015-03-22 - owagner
- fixed division by zero when switching TV channels
- now supports command/notify to send notifications
......
......@@ -11,6 +11,8 @@ __addon__ = xbmcaddon.Addon()
__version__ = __addon__.getAddonInfo('version')
activeplayerid=-1
lasttitle=""
lastdetail={}
def sendrpc(method,params):
res=xbmc.executeJSONRPC(json.dumps({"jsonrpc":"2.0","method":method,"params":params,"id":1}))
......@@ -74,10 +76,16 @@ def publishprogress():
#
def publishdetails():
global player,activeplayerid
global lasttitle,lastdetail
if not player.isPlaying():
return
res=sendrpc("Player.GetItem",{"playerid":activeplayerid,"properties":["title","streamdetails","file"]})
publish("title",res["result"]["item"]["title"],{"kodi_details":res["result"]["item"]})
newtitle=res["result"]["item"]["title"]
newdetail={"kodi_details":res["result"]["item"]}
if newtitle!=lasttitle or newdetail!=lastdetail:
lasttitle=newtitle
lastdetail=newdetail
publish("title",newtitle,newdetail)
publishprogress()
#
......@@ -179,7 +187,6 @@ def msghandler(mqc,userdata,msg):
def connecthandler(mqc,userdata,rc):
xbmc.log("MQTT: Connected to MQTT broker with rc=%d" % (rc))
mqc.publish(topic+"connected",2,qos=1,retain=True)
mqc.subscribe(topic+"command/#",qos=0)
def disconnecthandler(mqc,userdata,rc):
......@@ -203,6 +210,7 @@ def startmqtt():
mqc.will_set(topic+"connected",0,qos=2,retain=True)
xbmc.log("MQTT: Connecting to MQTT broker at %s:%s" % (__addon__.getSetting("mqtthost"),__addon__.getSetting("mqttport")))
mqc.connect(__addon__.getSetting("mqtthost"),__addon__.getSetting("mqttport"),60)
mqc.publish(topic+"connected",2,qos=1,retain=True)
mqc.loop_start()
#
......@@ -214,7 +222,7 @@ if (__name__ == "__main__"):
monitor=MQTTMonitor()
player=MQTTPlayer()
startmqtt()
while not monitor.waitForAbort(30):
publishprogress()
while not monitor.waitForAbort(20):
publishdetails()
mqc.loop_stop(True)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment