From 190da4fd4f7806ef70e4a4ae3ca89052dd072351 Mon Sep 17 00:00:00 2001 From: bkfox Date: Tue, 1 Dec 2015 17:13:03 +0100 Subject: [PATCH] fix get_monitor --- README.md | 4 ++-- aircox/liquidsoap/views.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bf6b14f..8d02542 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Aircox -Platform to manage a radio. +Platform to manage a radio. We use the power of Django ## Current features * **streams**: multiple random music streams when no program is played. We also can specify a time range and frequency; @@ -11,7 +11,7 @@ Platform to manage a radio. ## Applications * **programs**: managing stations, programs, schedules and diffusions. This is the core application, that handle most of the work. -* **cms**: cms renderer +* **cms**: cms manager with reusable tools. * **liquidsoap**: liquidsoap manager and control. ## Code and names conventions and uses diff --git a/aircox/liquidsoap/views.py b/aircox/liquidsoap/views.py index fd10530..cabcfcd 100644 --- a/aircox/liquidsoap/views.py +++ b/aircox/liquidsoap/views.py @@ -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):