run via: /opt/snapcastmpris/snapcastmpris.py -v --sync-alsa-volume (I am running on HiFiBerry OS RP 3B+ with HiFiBerry AMP2) + in SnapcastWrapper.py I have changed mixer = self.alsa.Mixer('Softvol') to mixer = self.alsa.Mixer('Digital') because on HiFiBerry AMP, audio seems to go there.
After changing the order as proposed in #8 and avoiding that issue, I ran into:
May 07 21:45:03 hifiberry-two python3[5664]: INFO: root - Snapcast wrapper thread started
May 07 21:45:03 hifiberry-two python3[5664]: INFO: root - SnapcastWrapper ALSA volume poll thread started
May 07 21:45:03 hifiberry-two python3[5664]: ERROR: websocket - error from callback <bound method SnapcastRpcWebsocketWrapper.on_ws_message of <SnapcastRpcWebsocketWrapper.SnapcastRpcWebsocketWrapper object at 0x74901e50>>: on_ws_message() takes 2 positional arguments but 3 were given
May 07 21:45:03 hifiberry-two python3[5664]: File "/usr/lib/python3.9/site-packages/websocket/_app.py", line 388, in _callback
May 07 21:45:05 hifiberry-two python3[5664]: INFO: root - main loop started
So when I changed the code from
def on_ws_message(self, message):
logging.debug("Snapcast RPC websocket message received")
logging.debug(message)
json_data = json.loads(message)
handlers = self.get_event_handlers_mapping()
event = json_data["method"]
handlers[event](json_data["params"])
to
def on_ws_message(self, websocket, message):
logging.debug("Snapcast RPC websocket message received")
logging.debug(message)
json_data = json.loads(message)
handlers = self.get_event_handlers_mapping()
event = json_data["method"]
handlers[event](json_data["params"])
it actually did what I guess it is supposed to.
Hope that is ok?
EDIT: I thought to do the same thing for on_ws_error and on_ws_close .
But I am not really sure: I do not have an issue on startup and all events seem to process (I can change the client audio from the snapserver web app @ snapserver:1780) however it seems that when I change the Digital volume on the client directly, I do get an error still...
May 07 23:37:15 hifiberry-two python3[7910]: ERROR: websocket - error from callback <bound method SnapcastRpcWebsocketWrapper.on_ws_message of <SnapcastRpcWebsocketWrapper.SnapcastRpcWebsocketWrapper object at 0x74907e98>>: 'Stream.OnProperties'
May 07 23:37:15 hifiberry-two python3[7910]: File "/usr/lib/python3.9/site-packages/websocket/_app.py", line 388, in _callback
May 07 23:37:15 hifiberry-two python3[7910]: File "/opt/snapcastmpris/SnapcastRpcWebsocketWrapper.py", line 49, in on_ws_message
May 07 23:37:15 hifiberry-two python3[7910]: handlers[event](json_data["params"])
Guess we need another constant at the top? RPC_EVENT_STREAM_PROPERTIES = "Stream.OnProperties" and insert that amongst the other in 'def get_event_handlers_mapping(self)...' ? But I am totally new to this so I am thinking out loud now...
run via:
/opt/snapcastmpris/snapcastmpris.py -v --sync-alsa-volume(I am running on HiFiBerry OS RP 3B+ with HiFiBerry AMP2) + in SnapcastWrapper.py I have changedmixer = self.alsa.Mixer('Softvol')tomixer = self.alsa.Mixer('Digital')because on HiFiBerry AMP, audio seems to go there.After changing the order as proposed in #8 and avoiding that issue, I ran into:
So when I changed the code from
to
it actually did what I guess it is supposed to.
Hope that is ok?
EDIT: I thought to do the same thing for on_ws_error and on_ws_close .
But I am not really sure: I do not have an issue on startup and all events seem to process (I can change the client audio from the snapserver web app @ snapserver:1780) however it seems that when I change the Digital volume on the client directly, I do get an error still...
Guess we need another constant at the top?
RPC_EVENT_STREAM_PROPERTIES = "Stream.OnProperties"and insert that amongst the other in 'def get_event_handlers_mapping(self)...' ? But I am totally new to this so I am thinking out loud now...