Skip to content
Snippets Groups Projects
Commit 1e325761 authored by Oliver Wagner's avatar Oliver Wagner
Browse files

v0.6 - 2015-07-29 - owagner

  - include "kodi_playerid" and "kodi_playertype" in playbackstate updates [#2]
parent dee5bca1
Branches
Tags
No related merge requests found
......@@ -44,6 +44,8 @@ The addon publishes on the following topics (prefixed with the configured topic
- "kodi_playbackdetails": an object with further details about the playback state. This is effectivly the result
of the JSON-RPC call Player.GetItem with the properties "speed", "currentsubtitle", "currentaudiostream", "repeat"
and "subtitleenabled"
- "kodi_playerid": the ID of the active player
- "kodi_playertype": the type of the active player (e.g. "video")
* status/progress: a JSON-encoded object with the fields
- "val" is the percentage of progress in playing back the current item
- "kodi_time": the playback position in the current item
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.mqtt" name="MQTT Adapter" version="0.5" provider-name="owagner">
<addon id="service.mqtt" name="MQTT Adapter" version="0.6" provider-name="owagner">
<requires>
<import addon="xbmc.python" version="2.19.0"/>
</requires>
......
v0.6 - 2015-07-29 - owagner
- include "kodi_playerid" and "kodi_playertype" in playbackstate updates [#2]
V0.5 - 2015-07-25 - owagner
- fixed script error occuring when playback details where not immediate
available when starting playback
......
......@@ -11,6 +11,7 @@ __addon__ = xbmcaddon.Addon()
__version__ = __addon__.getAddonInfo('version')
activeplayerid=-1
activeplayertype=""
lasttitle=""
lastdetail={}
......@@ -40,15 +41,16 @@ def publish(suffix,val,more):
# the state is "playing"
#
def setplaystate(state,detail):
global activeplayerid
global activeplayerid,activeplayertype
if state==1:
res=sendrpc("Player.GetActivePlayers",{})
activeplayerid=res["result"][0]["playerid"]
activeplayertype=res["result"][0]["type"]
res=sendrpc("Player.GetProperties",{"playerid":activeplayerid,"properties":["speed","currentsubtitle","currentaudiostream","repeat","subtitleenabled"]})
publish("playbackstate",state,{"kodi_state":detail,"kodi_playbackdetails":res["result"]})
publish("playbackstate",state,{"kodi_state":detail,"kodi_playbackdetails":res["result"],"kodi_playerid":activeplayerid,"kodi_playertype":activeplayertype})
publishdetails()
else:
publish("playbackstate",state,{"kodi_state":detail})
publish("playbackstate",state,{"kodi_state":detail,"kodi_playerid":activeplayerid,"kodi_playertype":activeplayertype})
def convtime(ts):
return("%02d:%02d:%02d" % (ts/3600,(ts/60)%60,ts%60))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment