Removing control_url, will now be included in stream path itself

This commit is contained in:
James Barnsley
2021-10-23 20:42:46 +13:00
parent 3b1609d5b8
commit 11cd13f576
17 changed files with 131 additions and 376 deletions

View File

@ -1152,40 +1152,6 @@ class IrisCore(pykka.ThreadingActor):
logger.debug(error)
return error
##
# Get a summary of this server's state.
# This is a collection of RPC-available requests, but those cannot be called via CORS, so this
# serves as a proxy for other Mopidy instances to be able to collect states.
##
async def get_server_state(self, *args, **kwargs):
callback = kwargs.get("callback", False)
request = kwargs.get("request", False)
current_track = self.core.playback.get_current_track().get()
if current_track:
# We dump the JSON to convert the Track to JSON, but we need to then loads back to JSON
# for the response.
current_track = json.loads(json.dumps(current_track, cls=ModelJSONEncoder))
images = self.core.library.get_images([current_track["uri"]]).get()
if images:
current_track["images"] = json.loads(
json.dumps(
images[current_track["uri"]],
cls=ModelJSONEncoder
)
)
response = {
"snapcast_stream": self.config["iris"]["snapcast_stream"],
"playback_state": self.core.playback.get_state().get(),
"current_track": current_track,
}
if callback:
callback(response)
else:
return response
##
# Send our current track data to the configured Snapcast server's stream
# Uses snapcast server and stream details as defined in configuration