Skip to content

Commit

Permalink
Merge pull request #82 from pfischi/develop
Browse files Browse the repository at this point in the history
merged from develop to v0.9
  • Loading branch information
spfuu committed Nov 22, 2016
2 parents 77b80d3 + 08ad07d commit ccef761
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 29 deletions.
121 changes: 119 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## Release

v.0.9 (2016-11-20)

-- added missing 'track_album' property
-- added missing 'track_album' to Sonos-Broker commandline
-- added "get_playlist_position" command and "playlist_position" property to Sonos Broker and
Sonos Broker commandline tool
-- added "get_playlist_total_tracks" command and "playlist_total_tracks" property to Sonos Broker and
Sonos Broker commandline tool
-- added missing 'track_album_art' property to Sonos Broker commandline tool
-- bug: 'playlist_position' was not handled correctly
-- changed maximum snippet length to 15 seconds
-- bugfixed: Sonos Broker user-specific server port was ignored
-- updated documentation

v.0.8.2 (2016-11-14)

-- fixed bug in GoogleTTS
Expand Down Expand Up @@ -316,7 +330,8 @@ In almost any cases, you'll get the appropriate response in the following JSON f
"mute": "0",
"pause": 0,
"play": 0,
"playlist_position": 0,
"playlist_position": "1",
"playlist_total_tracks": "10",
"playmode": "normal",
"radio_show": "",
"radio_station": "",
Expand All @@ -326,6 +341,7 @@ In almost any cases, you'll get the appropriate response in the following JSON f
"status": true,
"stop": 1,
"streamtype": "music",
"track_album": "Feuerwehrmann Sam 02",
"track_album_art": "http://192.168.0.4:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a3xCk8npVehdV55KuPdjrmZ%3fsid%3d9%26flags%3d32",
"track_artist": "Feuerwehrmann Sam & Clemens Gerhard",
"track_duration": "0:10:15",
Expand Down Expand Up @@ -396,10 +412,13 @@ Click on the links below to get a detailed command descriptions and their usage.
###### [set_playmode](#s_playmode)
###### [get_track_position](#g_track_position)
###### [set_track_position](#s_track_position)
###### [get_track_album](#g_track_album)
###### [get_track_title](#g_track_title)
###### [get_track_artist](#g_track_artist)
###### [get_track_album_art](#g_track_album_art)
###### [get_track_uri](#g_track_uri)
###### [get_playlist_position](#g_playlist_position)
###### [get_playlist_total_tracks](#g_playlist_total_tracks)
###### [get_radio_station](#g_radio_station)
###### [get_radio_show](#g_radio_show)
###### [join](#s_join)
Expand Down Expand Up @@ -1496,6 +1515,36 @@ No special parameter needed.

The response is only sent if the new value is different from the old value.

#### <a name="g_track_album">get_track_album
Returns the album title of the currently played track.
In most cases, you don't have to execute this command, because all subscribed clients will be notified automatically
about 'track_album'-status changes.

| parameter | required / optional | valid values | description |
| :-------- | :------------------ | :----------- | :---------- |
| uid | required | | The UID of the Sonos speaker. |

######Example
JSON format:
{
'command': 'get_track_album',
'parameter': {
'uid': 'rincon_b8e93730d19801410'
}
}

######HTTP Response
HTTP 200 OK or Exception with HTTP status 400 and the specific error message.

######UDP Response sent to subscribed clients:
JSON format:
{
...
"track_album": "Delta Machine",
"uid": "rincon_b8e93730d19801410",
...
}

#### <a name="g_track_title">get_track_title
Returns the title of the currently played track.
In most cases, you don't have to execute this command, because all subscribed clients will be notified automatically
Expand Down Expand Up @@ -1618,6 +1667,73 @@ No special parameter needed.

All URIs can be passed to the play_uri and play_snippet functions.

----
#### <a name="g_playlist_position">get_playlist_position
Returns the position of the currently played track in the playlist.
In most cases, you don't have to execute this command, because all subscribed clients will be notified automatically
about 'playlist_position'-status changes.

| parameter | required / optional | valid values | description |
| :-------- | :------------------ | :----------- | :---------- |
| uid | required | string | The UID of the Sonos speaker. |

######Example
JSON format:
{
'command': 'get_playlist_position',
'parameter': {
'uid': 'rincon_b8e91111d11111400'
}
}

######HTTP Response
HTTP 200 OK
or
Exception with HTTP status 400 and the specific error message.

###### UDP Response sent to subscribed clients:
JSON format:
{
...
"uid": "rincon_b8e91111d11111400",
"playlist_position": "3"
...
}

----
#### <a name="g_playlist_total_tracks">get_playlist_total_tracks
Returns the total number of tracks in the current playlist.
In most cases, you don't have to execute this command, because all subscribed clients will be notified automatically
about 'playlist_total_tracks'-status changes.

| parameter | required / optional | valid values | description |
| :-------- | :------------------ | :----------- | :---------- |
| uid | required | string | The UID of the Sonos speaker. |

######Example
JSON format:
{
'command': 'get_playlist_total_tracks',
'parameter': {
'uid': 'rincon_b8e91111d11111400'
}
}

######HTTP Response
HTTP 200 OK
or
Exception with HTTP status 400 and the specific error message.

###### UDP Response sent to subscribed clients:
JSON format:
{
...
"uid": "rincon_b8e91111d11111400",
"playlist_total_tracks": "13"
...
}

----
#### <a name="g_radio_station">get_radio_station
Returns the title of the currently played radio station.
In most cases, you don't have to execute this command, because all subscribed clients will be notified automatically
Expand Down Expand Up @@ -2048,7 +2164,8 @@ No special parameter needed.
"mute": 0,
"pause": 1,
"play": 0,
"playlist_position": 0,
"playlist_position": "1",
"playlist_total_tracks": "10",
"playmode": "normal",
"radio_show": "",
"radio_station": "",
Expand Down
31 changes: 15 additions & 16 deletions plugin.sonos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Smarthome.py framework (https://github.com/mknx/smarthome).

##Release

v0.9 (2016-11-20)

-- added missing 'track_album' property
-- add new property 'playlist_total_tracks'
-- change expected Sonos Broker version to 0.9

v0.8.2 (2016-11-14)

-- change expected Sonos Broker version to 0.8.2
Expand All @@ -25,25 +31,10 @@ v1.8 (2016-11-11)
-- 'clear_queue' command added. The command clears the current queue.
-- version check against Sonos Broker to identify an out-dated plugin or Broker

v1.7 (2016-01-03)

-- bug: discover function call now working
-- command "balance" added; documentation updated

v1.6 (2015-12-23)

-- function 'discover' added to perform a manual scan for new Sonos speaker

v1.5 (2015-10-30)

-- property 'display_version' added
-- property 'model_number' added
-- property 'household_id' added (a unique identifier for all players in a household)


## Requirements:

sonos_broker server v0.8
sonos_broker server v0.8.3
(https://github.com/pfischi/shSonos)

SmarthomeNG
Expand Down Expand Up @@ -161,6 +152,10 @@ Edit file with this sample of mine:
[[track_title]]
type = str
sonos_recv = track_title
[[track_album]]
type = str
sonos_recv = track_album

[[track_duration]]
type = str
Expand Down Expand Up @@ -189,6 +184,10 @@ Edit file with this sample of mine:
type = num
sonos_recv = playlist_position
visu_acl = rw

[[playlist_total_tracks]]
type = num
sonos_recv = playlist_total_tracks

[[streamtype]]
type = str
Expand Down
6 changes: 4 additions & 2 deletions plugin.sonos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import struct
import requests

EXPECTED_BROKER_VERSION = "0.8.2"
EXPECTED_BROKER_VERSION = "0.9"
logger = logging.getLogger('')
sonos_speaker = {}

Expand Down Expand Up @@ -503,7 +503,7 @@ def refresh_media_library(self, display_option='none'):
return self._send_cmd(SonosCommand.refresh_media_library(display_option))

def version(self):
return "v0.8.2\t2016-11-14"
return "v0.9\t2016-11-20"

def discover(self):
return self._send_cmd(SonosCommand.discover())
Expand All @@ -525,6 +525,7 @@ def __init__(self):
self.hardware_version = []
self.mac_address = []
self.playlist_position = []
self.playlist_total_tracks = []
self.volume = []
self.mute = []
self.led = []
Expand All @@ -537,6 +538,7 @@ def __init__(self):
self.track_duration = []
self.track_position = []
self.track_album_art = []
self.track_album = []
self.track_uri = []
self.radio_station = []
self.radio_show = []
Expand Down
8 changes: 8 additions & 0 deletions plugin.sonos/examples/sonos.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
sonos_send = previous
visu_acl = rw

[[track_album]]
type = str
sonos_recv = track_album

[[track_title]]
type = str
sonos_recv = track_title
Expand Down Expand Up @@ -121,6 +125,10 @@
sonos_recv = playlist_position
visu_acl = rw

[[playlist_total_tracks]]
type = num
sonos_recv = playlist_total_tracks

[[streamtype]]
type = str
sonos_recv = streamtype
Expand Down
Binary file removed server.sonos/dist/sonos-broker-0.8.2.tar.gz
Binary file not shown.
Binary file added server.sonos/dist/sonos-broker-0.9.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions server.sonos/lib_sonos/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
# regular expressions to find sonos meta info through udp stream
ip_pattern = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'

VERSION_BUILDSTRING = "v0.8.2 (2016-11-14)"
VERSION = "0.8.2"
VERSION_BUILDSTRING = "v0.9 (2016-11-20)"
VERSION = "0.9"


DEFAULT_HOST = '0.0.0.0'
Expand Down
Loading

0 comments on commit ccef761

Please sign in to comment.