]> git.parisson.com Git - telecaster-client.git/commitdiff
mv status obj
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 10 Jan 2014 14:49:33 +0000 (15:49 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 10 Jan 2014 14:49:33 +0000 (15:49 +0100)
telecaster/models.py
telecaster/static/telecaster/js/application.js
telecaster/tools/status.py
telecaster/views.py

index dcea59c6045e68b19dec887bed9c63d024f9357f..ce5bb32db2cfc7ea628e0ce501f4f491fe98f702 100644 (file)
@@ -68,7 +68,6 @@ class ShortTextField(models.TextField):
          )
          return super(ShortTextField, self).formfield(**kwargs)
 
-
 add_introspection_rules([], ["^telecaster\.models\.ShortTextField"])
 
 
index b761b37df7f086dd651dd61a071373e025b7a690..8a71ebf962bf9e89c83f99a5c5b9d16eca0c565b 100644 (file)
@@ -211,8 +211,6 @@ var playlistUtils = {
 
         var o = 'organization';
         var d = 'department';
-        var d = 'department';
-
         var dd = {};
         var playlist = this;
 
index 32e9786432ff00e817c0e6cfca9f73657547fb97..d89c1ddf718459b7c5311d35dd5ca7a266cc1e80 100644 (file)
 # Author: Guillaume Pellerin <yomguy@parisson.com>
 """
 
-import os
-from telecaster.tools import *
-from django.conf import settings
 
-class Status(object):
 
-    interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', 'eth5',
-                  'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4']
-    acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'}
-
-    def __init__(self):
-        self.acpi = acpi.Acpi()
-        self.uid = os.getuid()
-        self.user = pwd.getpwuid(os.getuid())[0]
-        self.cache = settings.MEDIA_ROOT + 'cache/'
-        self.monitoring_conf_dir = '/etc/telecaster/deefuzzer/'
-        self.mp3_monitoring_conf = self.monitoring_conf_dir + 'telecaster_mp3_monitor.yaml'
-        self.webm_monitoring_conf = self.monitoring_conf_dir + 'telecaster_webm_monitor.yaml'
-        self.mp3_streaming_conf = self.cache + 'station_mp3.xml'
-        self.webm_streaming_conf = self.cache + 'station_webm.xml'
-
-    def update(self):
-        self.acpi.update()
-        try:
-            self.temperature = self.acpi.temperature(0)
-        except:
-            self.temperature = 'N/A'
-        self.get_ids()
-        self.get_hosts()
-
-    def to_dict(self):
-        status = [
-          {'id': 'name', 'class': 'default', 'value': self.name, 'label': 'Name'},
-          {'id': 'ip', 'class': 'default', 'value': self.ip, 'label': 'IP address'},
-          {'id': 'acpi_state','class': 'default', 'value': 'AC', 'label': 'Power'},
-          {'id': 'acpi_percent', 'class': 'default', 'value': str(self.acpi.percent()), 'label': 'Charge (%)'},
-          {'id': 'temperature', 'class': 'default', 'value': self.temperature, 'label': 'Temperature'},
-          {'id': 'jackd', 'class': 'default', 'value': self.jacking, 'label': 'Jack server'},
-          {'id': 'audio_encoding','class': 'default',
-                'value': self.audio_encoding, 'label': 'Audio encoding'},
-          {'id': 'video_encoding','class': 'default',
-                'value': self.video_encoding, 'label': 'Video encoding'},
-          {'id': 'audio_monitoring', 'class': 'default',
-                'value': self.audio_monitoring, 'label': 'Audio monitoring'},
-          {'id': 'video_monitoring', 'class': 'default',
-                'value': self.video_monitoring, 'label': 'Video monitoring'},
-          {'id': 'audio_streaming', 'class': 'default',
-                'value': self.audio_streaming, 'label': 'Audio streaming'},
-          {'id': 'video_streaming', 'class': 'default',
-                'value': self.video_streaming, 'label': 'Video streaming'},
-          ]
-
-        for stat in status:
-            if stat['value'] == False or stat['value'] == 'localhost' or stat['value'] == 'battery':
-                stat['class'] = 'warning'
-
-        return status
-
-    def get_hosts(self):
-        ip = ''
-        for interface in self.interfaces:
-            try:
-                ip = get_ip_address(interface)
-                if ip:
-                    self.ip = ip
-                    break
-            except:
-                self.ip = '127.0.0.1'
-        self.url = 'http://' + self.ip
-        self.name = get_hostname()
-
-    def get_ids(self):
-        self.jacking = get_pid('jackd', args=False) != None
-
-        self.audio_encoding = get_pid('gst-launch-0.10', args='lamemp3enc') != None
-        self.video_encoding = get_pid('gst-launch-0.10', args='vp8enc') != None
-
-        self.audio_monitoring = get_pid('deefuzzer', args=self.mp3_monitoring_conf) != None
-        self.video_monitoring = get_pid('deefuzzer', args=self.webm_monitoring_conf) != None
-
-        self.audio_streaming = get_pid('deefuzzer', args=self.mp3_streaming_conf) != None
-        self.video_streaming = get_pid('deefuzzer', args=self.webm_streaming_conf) != None
index d41cef5ef4cfdbc53116bf359f9e799ec0f9c0c5..c3ed741d0526eb2d828546cb277d1c27ff44d1b4 100644 (file)
@@ -10,6 +10,7 @@ from models import *
 from forms import*
 
 from jsonrpc import jsonrpc_method
+from jsonrpc.proxy import ServiceProxy
 
 from django.utils.decorators import method_decorator
 from django.contrib.auth import authenticate, login
@@ -41,8 +42,91 @@ def get_host(request):
         host = host.split(':')[0]
     return host
 
+
 status = Status()
 
+
+class Status(object):
+
+    interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', 'eth5',
+                  'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4']
+    
+    acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'}
+
+    def __init__(self):
+        self.acpi = acpi.Acpi()
+        self.uid = os.getuid()
+        self.user = pwd.getpwuid(os.getuid())[0]
+        self.cache = settings.MEDIA_ROOT + 'cache/'
+        self.monitoring_conf_dir = '/etc/telecaster/deefuzzer/'
+        self.mp3_monitoring_conf = self.monitoring_conf_dir + 'telecaster_mp3_monitor.yaml'
+        self.webm_monitoring_conf = self.monitoring_conf_dir + 'telecaster_webm_monitor.yaml'
+        self.mp3_streaming_conf = self.cache + 'station_mp3.xml'
+        self.webm_streaming_conf = self.cache + 'station_webm.xml'
+
+    def update(self):
+        self.acpi.update()
+        try:
+            self.temperature = self.acpi.temperature(0)
+        except:
+            self.temperature = 'N/A'
+        self.get_pids()
+        self.get_hosts()
+
+    def to_dict(self):
+        status = [
+          {'id': 'name', 'class': 'default', 'value': self.name, 'label': 'Name'},
+          {'id': 'ip', 'class': 'default', 'value': self.ip, 'label': 'IP address'},
+          {'id': 'acpi_state','class': 'default', 'value': 'AC', 'label': 'Power'},
+          {'id': 'acpi_percent', 'class': 'default', 'value': str(self.acpi.percent()), 'label': 'Charge (%)'},
+          {'id': 'temperature', 'class': 'default', 'value': self.temperature, 'label': 'Temperature'},
+          {'id': 'jackd', 'class': 'default', 'value': self.jacking, 'label': 'Jack server'},
+          {'id': 'audio_encoding','class': 'default',
+                'value': self.audio_encoding, 'label': 'Audio encoding'},
+          {'id': 'video_encoding','class': 'default',
+                'value': self.video_encoding, 'label': 'Video encoding'},
+          {'id': 'audio_monitoring', 'class': 'default',
+                'value': self.audio_monitoring, 'label': 'Audio monitoring'},
+          {'id': 'video_monitoring', 'class': 'default',
+                'value': self.video_monitoring, 'label': 'Video monitoring'},
+          {'id': 'audio_streaming', 'class': 'default',
+                'value': self.audio_streaming, 'label': 'Audio streaming'},
+          {'id': 'video_streaming', 'class': 'default',
+                'value': self.video_streaming, 'label': 'Video streaming'},
+          ]
+
+        for stat in status:
+            if stat['value'] == False or stat['value'] == 'localhost' or stat['value'] == 'battery':
+                stat['class'] = 'warning'
+
+        return status
+
+    def get_hosts(self):
+        ip = ''
+        for interface in self.interfaces:
+            try:
+                ip = get_ip_address(interface)
+                if ip:
+                    self.ip = ip
+                    break
+            except:
+                self.ip = '127.0.0.1'
+        self.url = 'http://' + self.ip
+        self.name = get_hostname()
+
+    def get_pids(self):
+        self.jacking = get_pid('jackd', args=False) != None
+
+        self.audio_encoding = get_pid('gst-launch-0.10', args='lamemp3enc') != None
+        self.video_encoding = get_pid('gst-launch-0.10', args='vp8enc') != None
+
+        self.audio_monitoring = get_pid('deefuzzer', args=self.mp3_monitoring_conf) != None
+        self.video_monitoring = get_pid('deefuzzer', args=self.webm_monitoring_conf) != None
+
+        self.audio_streaming = get_pid('deefuzzer', args=self.mp3_streaming_conf) != None
+        self.video_streaming = get_pid('deefuzzer', args=self.webm_streaming_conf) != None
+
+
 class StatusView(object):
 
     @jsonrpc_method('telecaster.get_server_status')
@@ -66,3 +150,4 @@ class StatusView(object):
     @jsonrpc_method('telecaster.stop')
     def stop(request):
         pass
+