Re-add hot output switching, add default output support.

This commit is contained in:
Matthew Stratford 2020-11-05 18:59:28 +00:00
parent cb42eec757
commit 23647de797
No known key found for this signature in database
GPG key ID: 9E53C8B3F0B57395
2 changed files with 7 additions and 2 deletions

View file

@ -297,9 +297,10 @@ class Player():
def output(self, name=None):
wasPlaying = self.state.state["playing"]
name = None if name == "none" else name
self.quit()
self.state.update("output", name)
self.state.update("loaded_item", None)
try:
if name:
mixer.init(44100, -16, 2, 1024, devicename=name)
@ -309,6 +310,9 @@ class Player():
self.logger.log.exception("Failed to init mixer with device name: " + str(name))
return False
loadedItem = self.state.state["loaded_item"]
if (loadedItem):
self.load(loadedItem.timeslotitemid)
if wasPlaying:
self.unpause()

View file

@ -1,8 +1,9 @@
{% extends 'base.html' %}
{% block content_inner %}
<code>
<a href="/player/0/output/none">Set Channel 0</a> <a href="/player/1/output/none">Set Channel 1</a> <a href="/player/2/output/none">Set Channel 2</a> - System Default Output<br>
{% for output in data.outputs %}
<a href="/player/0/output/{{output.name}}">Set Channel 0</a> <a href="/player/1/output/{{output.name}}">Set Channel 1</a> <a href="/player/2/output/{{output.name}}">Set Channel 2</a> - {{output.name}}<br>
{% endfor %}
</code>
{% endblock %}
{% endblock %}