self.file_dir = self.output_dir + os.sep + self.ServerName
self.uid = os.getuid()
self.odd_pid = get_pid('^edcast_jack', self.uid)
- self.deefuzzer_pid = get_pid('/usr/bin/deefuzzer '+self.deefuzzer_user_file, self.uid)
+ if os.path.exists('/usr/local/bin/deefuzzer'):
+ self.deefuzzer_path = '/usr/local/bin/deefuzzer'
+ elif os.path.exists('/usr/bin/deefuzzer'):
+ self.deefuzzer_path = '/usr/bin/deefuzzer'
+ self.deefuzzer_pid = get_pid(self.deefuzzer_path+' '+self.deefuzzer_user_file, self.uid)
self.new_title = clean_string('-'.join(self.server_name)+'-'+self.session+'-'+self.professor+'-'+self.comment)
self.short_title = clean_string('-'.join(self.conference)+'-'+self.session+'-'+self.professor+'-'+self.comment)
self.genre = self.conf['infos']['genre']
os.remove(self.lock_file)
def deefuzzer_stop(self):
- if len(self.deefuzzer_pid) != 0:
- os.system('kill -9 '+self.deefuzzer_pid[0])
+ if len(self.deefuzzer_pid) != 0:
+ os.system('kill -9 '+self.deefuzzer_pid[0])
def rec_stop(self):
if len(self.deefuzzer_pid) != 0:
- for port in self.deefuzzer_osc_ports:
- target = liblo.Address(int(port))
+ for port in self.deefuzzer_osc_ports:
+ target = liblo.Address(int(port))
liblo.send(target, '/record', 0)
def mp3_convert(self):
if not os.path.exists(self.user_dir):
os.makedirs(self.user_dir)
self.lock_file = self.user_dir + os.sep + 'telecaster.lock'
-
+ if os.path.exists('/usr/local/bin/deefuzzer'):
+ self.deefuzzer_path = '/usr/local/bin/deefuzzer'
+ elif os.path.exists('/usr/bin/deefuzzer'):
+ self.deefuzzer_path = '/usr/bin/deefuzzer'
+
def transition_head(self):
html_file = open('telecaster_starting_head.html', 'r')
html = html_file.read()
def main(self):
edcast_pid = get_pid('edcast_jack', self.uid)
- deefuzzer_pid = get_pid('/usr/bin/deefuzzer '+self.user_dir+os.sep+'deefuzzer.xml', self.uid)
+
+ deefuzzer_pid = get_pid(self.deefuzzer_path+' '+self.user_dir+os.sep+'deefuzzer.xml', self.uid)
writing = edcast_pid != []
casting = deefuzzer_pid != []
form = WebView(self.conf, version)
if deefuzzer_pid == [] and form.has_key("action") and \
form.has_key("department") and form.has_key("conference") and \
form.has_key("session") and form["action"].value == "start":
-
+
self.conference_dict = {'title': '',
'department': '',
'conference': '',
'professor': '',
'comment': ''}
- for data in self.conference_dict:
- if not form.has_key(data):
- self.conference_dict[data] = 'Inconnu'
- else:
- value = form.getfirst(data)
- if '....' in value:
- self.conference_dict[data] = 'Inconnu'
- else:
- self.conference_dict[data] = value
-
- self.conference_dict['title'] = self.title
+ for data in self.conference_dict:
+ if not form.has_key(data):
+ self.conference_dict[data] = 'Inconnu'
+ else:
+ value = form.getfirst(data)
+ if '....' in value:
+ self.conference_dict[data] = 'Inconnu'
+ else:
+ self.conference_dict[data] = value
+
+ self.conference_dict['title'] = self.title
s = Station(self.conf_file, self.conference_dict, self.lock_file)
s.start()
time.sleep(2)
self.logger.write_info('started')
elif deefuzzer_pid and form.has_key("action") and form["action"].value == "stop":
- self.logger.write_info('stopping')
+ self.logger.write_info('stopping')
if os.path.exists(self.lock_file):
self.conference_dict = get_conference_from_lock(self.lock_file)
- s = Station(self.conf_file, self.conference_dict, self.lock_file)
+ s = Station(self.conf_file, self.conference_dict, self.lock_file)
s.stop()
- time.sleep(2)
- self.main()
+ time.sleep(2)
+ self.main()
elif deefuzzer_pid == []:
form.start_form(writing, casting)
elif deefuzzer_pid != []:
os.system('kill -9 '+deefuzzer_pid[0])
self.main()
-
conf_file = '/etc/telecaster/telecaster.xml'
--- /dev/null
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+