fix get_monitor

This commit is contained in:
bkfox
2015-12-01 17:13:03 +01:00
parent a5666bb376
commit 190da4fd4f
2 changed files with 7 additions and 5 deletions

View File

@ -13,6 +13,8 @@ import aircox.programs.models as models
view_monitor = None
def get_monitor():
global view_monitor
if not view_monitor:
view_monitor = utils.Monitor(
utils.Connector(address = settings.AIRCOX_LIQUIDSOAP_SOCKET)
@ -42,10 +44,10 @@ class LiquidControl (View):
template_name = 'aircox_liquidsoap/controller.html'
def get_context_data (self, **kwargs):
get_view_monitor().update()
get_monitor().update()
return {
'request': self.request,
'monitor': get_view_monitor(),
'monitor': get_monitor(),
'embed': 'embed' in self.request.GET,
}
@ -55,7 +57,7 @@ class LiquidControl (View):
controller = POST.get('controller')
source = POST.get('source')
action = POST.get('action')
Actions.exec(get_view_monitor(), controller, source, action)
Actions.exec(get_monitor(), controller, source, action)
return HttpResponse('')
def get (self, request = None, **kwargs):