Server listeners for snapcast
This commit is contained in:
@ -56,7 +56,11 @@ class IrisSnapcast(object):
|
||||
|
||||
while self.listen:
|
||||
|
||||
readlist, writelist, exceptionlist = select.select([self.sock], [], [], 5)
|
||||
# This loop will run constantly in the background, so we need a relatively short
|
||||
# timeout as this would otherwise block the shutdown sequence
|
||||
timeout = 1
|
||||
|
||||
readlist, writelist, exceptionlist = select.select([self.sock], [], [], timeout)
|
||||
|
||||
# Check if we've got any lists
|
||||
if [readlist, writelist, exceptionlist] != [[], [], []]:
|
||||
@ -64,7 +68,8 @@ class IrisSnapcast(object):
|
||||
# Rread and print the available data on any of the read list
|
||||
for socket in readlist:
|
||||
|
||||
message = socket.recv(1024)
|
||||
# Allow a relatively large buffer size to handle large JSON payloads
|
||||
message = socket.recv(8192)
|
||||
|
||||
try:
|
||||
message = json.loads(message)
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
190
mopidy_iris/static/app.min.css
vendored
190
mopidy_iris/static/app.min.css
vendored
File diff suppressed because one or more lines are too long
12
mopidy_iris/static/app.min.js
vendored
12
mopidy_iris/static/app.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -98,7 +98,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1541209549";
|
||||
var build = "1541361367";
|
||||
var version = "3.29.2";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
@ -394,13 +394,32 @@ const SnapcastMiddleware = (function(){
|
||||
|
||||
case 'SNAPCAST_EVENT_RECEIVED':
|
||||
|
||||
console.log(action)
|
||||
|
||||
// Drop the prefix
|
||||
action.method = action.method.replace('snapcast_','');
|
||||
|
||||
switch (action.method){
|
||||
|
||||
case 'Client.OnConnect':
|
||||
store.dispatch(snapcastActions.clientLoaded(
|
||||
{
|
||||
id: action.params.client.id,
|
||||
name: action.params.client.name,
|
||||
volume: action.params.client.volume.percent,
|
||||
mute: action.params.client.volume.muted,
|
||||
connected: action.params.client.connected
|
||||
}
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Client.OnDisconnect':
|
||||
store.dispatch(snapcastActions.clientLoaded(
|
||||
{
|
||||
id: action.params.client.id,
|
||||
connected: action.params.client.connected
|
||||
}
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Client.OnVolumeChanged':
|
||||
store.dispatch(snapcastActions.clientLoaded(
|
||||
{
|
||||
@ -428,6 +447,19 @@ const SnapcastMiddleware = (function(){
|
||||
}
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Group.OnMute':
|
||||
store.dispatch(snapcastActions.groupLoaded(
|
||||
{
|
||||
id: action.params.id,
|
||||
mute: action.params.mute
|
||||
}
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Server.OnUpdate':
|
||||
store.dispatch(snapcastActions.serverLoaded(action.params));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user