Commit c9637189 authored by Oliver Wagner's avatar Oliver Wagner
Browse files

v0.13 - 2016-05-01 - owagner

  - change logic for command/playbackstate:
     - resume/play/1 will now properly resume when pausing, and attempt to
       start play when playback has endeded. Fixes #17
     - pause/2 will now only pause if the player is actually playing.
       It can no longer be used to toggle pause mode.
     - toggle (new) will now toggle pause mode, similarily to how "pause"
       did before

Also updated README.md, which was lagging behind describing new settings
parent 230671e4
......@@ -18,7 +18,7 @@ See https://github.com/mqtt-smarthome for a rationale and architectural overview
Dependencies
------------
* Kodi 14 Helix (or newer)
* Kodi 14 Helix (or newer). Tested with 16.1.
* Eclipse Paho for Python - http://www.eclipse.org/paho/clients/python/
(used for MQTT communication)
......@@ -27,11 +27,14 @@ Dependencies
Settings
--------
The addon has three settings:
The addon has multiple settings:
* 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/".
* MQTT authentication and TLS settings
* update frequency intervals
* keyword filtering on content details, to prevent certain kind of content to be e.g. displayed in a SmartHome visualization
Topics
......@@ -64,8 +67,9 @@ The addon listens to the following topics (prefixed with the configured topic pr
to the Player.Open() JSON_RPC call
* command/playbackstate: A simple string or numeric with the values:
- "0" or "stop" to stop playback
- "1" or "resume" to resume playback (when paused)
- "1" or "resume" or "play" to resume playback (when paused or stopped)
- "2" or "pause" to stop playback (when playing)
- "toggle" to toggle between play and pause
- "next" to play the next track
- "previous" to play the previous track
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.mqtt" name="MQTT Adapter" version="0.12" provider-name="owagner">
<addon id="service.mqtt" name="MQTT Adapter" version="0.13" provider-name="owagner">
<requires>
<import addon="xbmc.python" version="2.19.0"/>
</requires>
<extension point="xbmc.service" library="service.py" start="login" />
<extension point="xbmc.addon.metadata">
<summary lang="en">MQTT Adapter, adhering to mqtt-smarthome specification</summary>
<description lang="en">The addon is an adapter to a MQTT broker. It will publish information about what is playing, and provides remote control capability. It adheres to the mqtt-smarthome specification. </description>
<description lang="en">The addon is an adapter to an MQTT broker. It will publish information about what is playing, and provides remote control capability. It adheres to the mqtt-smarthome specification. </description>
<disclaimer lang="en"></disclaimer>
<platform>all</platform>
<license>MIT</license>
......
v0.13 - 2016-05-01 - owagner
- change logic for command/playbackstate:
- resume/play/1 will now properly resume when pausing, and attempt to
start play when playback has endeded. Fixes #17
- pause/2 will now only pause if the player is actually playing.
It can no longer be used to toggle pause mode.
- toggle (new) will now toggle pause mode, similarily to how "pause"
did before
v0.12 - 2016-02-022 - markferry
- fix non-JSON case for handling command/notify
......
......@@ -25,6 +25,7 @@ def load_settings():
activeplayerid=-1
activeplayertype=""
playbackstate=0
lasttitle=""
lastdetail={}
......@@ -66,7 +67,8 @@ def publish(suffix,val,more):
# the state is "playing"
#
def setplaystate(state,detail):
global activeplayerid,activeplayertype
global activeplayerid,activeplayertype,playbackstate
playbackstate=state
if state==1:
res=sendrpc("Player.GetActivePlayers",{})
activeplayerid=res["result"][0]["playerid"]
......@@ -185,13 +187,19 @@ def processplay(data):
player.play(data)
def processplaybackstate(data):
global playbackstate
if data=="0" or data=="stop":
player.stop()
elif data=="1" or data=="resume":
if not player.isPlaying():
elif data=="1" or data=="resume" or data=="play":
if playbackstate==2:
player.pause()
elif playbackstate!=1:
player.play()
elif data=="2" or data=="pause":
if player.isPlaying():
if playbackstate==1:
player.pause()
elif data=="toggle":
if playbackstate==1 or playbackstate==2:
player.pause()
elif data=="next":
player.playnext()
......
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