fix get_monitor
This commit is contained in:
		@ -1,5 +1,5 @@
 | 
				
			|||||||
# Aircox
 | 
					# Aircox
 | 
				
			||||||
Platform to manage a radio.
 | 
					Platform to manage a radio. We use the power of Django
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Current features
 | 
					## Current features
 | 
				
			||||||
* **streams**: multiple random music streams when no program is played. We also can specify a time range and frequency;
 | 
					* **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
 | 
					## Applications
 | 
				
			||||||
* **programs**: managing stations, programs, schedules and diffusions. This is the core application, that handle most of the work.
 | 
					* **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.
 | 
					* **liquidsoap**: liquidsoap manager and control.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Code and names conventions and uses
 | 
					## Code and names conventions and uses
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,8 @@ import aircox.programs.models as models
 | 
				
			|||||||
view_monitor = None
 | 
					view_monitor = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_monitor():
 | 
					def get_monitor():
 | 
				
			||||||
 | 
					    global view_monitor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not view_monitor:
 | 
					    if not view_monitor:
 | 
				
			||||||
        view_monitor = utils.Monitor(
 | 
					        view_monitor = utils.Monitor(
 | 
				
			||||||
            utils.Connector(address = settings.AIRCOX_LIQUIDSOAP_SOCKET)
 | 
					            utils.Connector(address = settings.AIRCOX_LIQUIDSOAP_SOCKET)
 | 
				
			||||||
@ -42,10 +44,10 @@ class LiquidControl (View):
 | 
				
			|||||||
    template_name = 'aircox_liquidsoap/controller.html'
 | 
					    template_name = 'aircox_liquidsoap/controller.html'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_context_data (self, **kwargs):
 | 
					    def get_context_data (self, **kwargs):
 | 
				
			||||||
        get_view_monitor().update()
 | 
					        get_monitor().update()
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'request': self.request,
 | 
					            'request': self.request,
 | 
				
			||||||
            'monitor': get_view_monitor(),
 | 
					            'monitor': get_monitor(),
 | 
				
			||||||
            'embed': 'embed' in self.request.GET,
 | 
					            'embed': 'embed' in self.request.GET,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -55,7 +57,7 @@ class LiquidControl (View):
 | 
				
			|||||||
            controller = POST.get('controller')
 | 
					            controller = POST.get('controller')
 | 
				
			||||||
            source = POST.get('source')
 | 
					            source = POST.get('source')
 | 
				
			||||||
            action = POST.get('action')
 | 
					            action = POST.get('action')
 | 
				
			||||||
            Actions.exec(get_view_monitor(), controller, source, action)
 | 
					            Actions.exec(get_monitor(), controller, source, action)
 | 
				
			||||||
        return HttpResponse('')
 | 
					        return HttpResponse('')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get (self, request = None, **kwargs):
 | 
					    def get (self, request = None, **kwargs):
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user