forked from platypush/platypush
Weird Jinja bug broke the web panel load when using JSON parse, had to refactor it a bit to fix it
This commit is contained in:
parent
d91e494940
commit
19eab381ae
2 changed files with 7 additions and 10 deletions
|
@ -3,14 +3,7 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.config = window.config || {};
|
window.config = window.config || {};
|
||||||
window.config.snapcast_hosts = {};
|
window.config.snapcast_hosts = JSON.parse('{{ utils.get_plugin("music.snapcast").backend_hosts_json | safe }}');
|
||||||
|
|
||||||
hosts = JSON.parse('{{ utils.to_json(utils.get_plugin("music.snapcast").backend_hosts) | safe }}');
|
|
||||||
ports = JSON.parse('{{ utils.to_json(utils.get_plugin("music.snapcast").backend_ports) | safe }}');
|
|
||||||
|
|
||||||
for (var i=0; i < hosts.length; i++) {
|
|
||||||
window.config.snapcast_hosts[hosts[i]] = ports[i];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="snapcast-host-modal" class="modal snapcast-modal">
|
<div id="snapcast-host-modal" class="modal snapcast-modal">
|
||||||
|
|
|
@ -36,8 +36,12 @@ class MusicSnapcastPlugin(Plugin):
|
||||||
self._latest_req_id_lock = threading.RLock()
|
self._latest_req_id_lock = threading.RLock()
|
||||||
|
|
||||||
backend = get_backend('music.snapcast')
|
backend = get_backend('music.snapcast')
|
||||||
self.backend_hosts = backend.hosts if backend else [self.host]
|
backend_hosts = backend.hosts if backend else [self.host]
|
||||||
self.backend_ports = backend.ports if backend else [self.port]
|
backend_ports = backend.ports if backend else [self.port]
|
||||||
|
self.backend_hosts_json = json.dumps({
|
||||||
|
backend_hosts[i]: backend_ports[i]
|
||||||
|
for i in range(len(backend_hosts))
|
||||||
|
})
|
||||||
|
|
||||||
def _get_req_id(self):
|
def _get_req_id(self):
|
||||||
with self._latest_req_id_lock:
|
with self._latest_req_id_lock:
|
||||||
|
|
Loading…
Reference in a new issue