if not os.path.exists(self.user_dir):
os.makedirs(self.user_dir)
self.lock_file = self.user_dir + os.sep + 'telecaster.lock'
- self.form = WebView(self.conf, version)
+
+ def transition_head(self):
+ html_file = open('telecaster_starting_head.html', 'r')
+ html = html_file.read()
+ html_file.close()
+ return html
+
+ def transition_foot(self):
+ html_file = open('telecaster_starting_foot.html', 'r')
+ html = html_file.read()
+ html_file.close()
+ return html
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)
writing = edcast_pid != []
casting = deefuzzer_pid != []
+ self.form = WebView(self.conf, version)
if deefuzzer_pid == [] and self.form.has_key("action") and \
self.form.has_key("department") and self.form.has_key("conference") and \
'professor': self.form.getfirst("professor"),
'comment': self.form.getfirst("comment")}
+ self.form = 0
+ #print "Content-Type: text/html\n\n"
+ #print self.transition_head()
s = Station(self.conf_file, self.conference_dict, self.lock_file)
s.start()
+# time.sleep(1)
+ #print self.transition_foot()
self.logger.write_info('starting')
- time.sleep(2)
self.main()
elif deefuzzer_pid != [] and os.path.exists(self.lock_file) and not self.form.has_key("action"):
self.conference_dict = get_conference_from_lock(self.lock_file)
self.form.stop_form(self.conference_dict, writing, casting)
- self.logger.write_info('page stop')
+ self.logger.write_info('started')
elif deefuzzer_pid and self.form.has_key("action") and self.form["action"].value == "stop":
if os.path.exists(self.lock_file):
elif deefuzzer_pid == []:
self.form.start_form(writing, casting)
- self.logger.write_info('page start')
-
+ self.logger.write_info('stopped')
+
conf_file = '/etc/telecaster/telecaster.xml'
if __name__ == '__main__':
t = TeleCaster(conf_file)
t.main()
+
import os
import cgi
-import cgitb
-import shutil
+#import cgitb
import datetime
import time
-import codecs
import string
-import signal
-import unicodedata
from tools import *
from cgi import FieldStorage
-cgitb.enable()
+#cgitb.enable()
class WebView(FieldStorage):
"""Gives the web CGI frontend"""
def header(self):
# Required header that tells the browser how to render the HTML.
- print "Content-Type: text/html\n"
+ print "Content-Type: text/html\n\n"
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
print "<HTML>"
print "<HEAD>"
else:
print "<button class=\"negative\"><img src=\"img/drive_error.png\" alt=\"\">NOT Recording !</button>"
print "</div></td>"
- print "<TD> </TD>"
+ print "<td></td>"
print "<td><div class=\"buttons\">"
if self.casting:
print "<button class=\"positive\"><img src=\"img/transmit_add.png\" alt=\"\">Diffusing...</button>"
self.javascript()
self.sub_header()
self.hardware_data()
- print "<form method=\"POST\" action=\"telecaster.py\" name=\"formulaire_start\">"
+
+ print "<form method=\"POST\" action=\"telecaster.py\" name=\"formulaire\">"
print "<div class=\"main\">"
print "<table class=\"form\">"
print "<TR><TH align=\"left\">Titre</TH><TD> : </TD><TD>"+self.title+"</TD></TR>"
print "<TR><TH align=\"left\">Département</TH><TD> : </TD>"
print "<TD><select name=\"department\" onChange=\"choix(this.form)\">"
- print "<option value=\"unknown\">...........Choisissez un département...........</option>"
+ print "<option selected=\"\">...........Choisissez un département...........</option>"
for department in self.departments:
print "<option value=\""+department['name']+"\">"+department['name']+"</option>"
print "</select></TD></TR>"
print "<TR><TH align=\"left\">Conférence</TH><TD> : </TD>"
print "<TD><select name=\"conference\">"
- print "<option value=\"unknown\">...........Choisissez une conférence...........</option>"
+ print "<option selected=\"\">...........Choisissez une conférence...........</option>"
for i in range(1,self.conference_nb_max):
print "<option></option>"
print "</select></TD></TR>"
self.header()
self.sub_header()
+
+ print "<form method=\"POST\" action=\"telecaster.py\" name=\"formulaire\">"
+
self.hardware_data()
- print "<form method=\"POST\" action=\"telecaster.py\" name=\"formulaire_stop\">"
+
print "<div class=\"main\">"
print "<table class=\"form\">"
print "<TR><TH align=\"left\">Titre</TH><TD> : </TD><TD>"+self.title+"</TD></TR>"