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 main(self):
edcast_pid = get_pid('edcast_jack', self.uid)
deefuzzer_pid = get_pid('/usr/bin/deefuzzer', 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("professor") and form.has_key("comment") and \
- form["action"].value == "start":
+ if deefuzzer_pid == [] and self.form.has_key("action") and \
+ self.form.has_key("department") and self.form.has_key("conference") and \
+ self.form.has_key("professor") and self.form.has_key("comment") and \
+ self.form["action"].value == "start":
self.conference_dict = {'title': self.title,
- 'department': form.getfirst("department"),
- 'conference': form.getfirst("conference"),
- 'session': form.getfirst("session"),
- 'professor': form.getfirst("professor"),
- 'comment': form.getfirst("comment")}
+ 'department': self.form.getfirst("department"),
+ 'conference': self.form.getfirst("conference"),
+ 'session': self.form.getfirst("session"),
+ 'professor': self.form.getfirst("professor"),
+ 'comment': self.form.getfirst("comment")}
s = Station(self.conf_file, self.conference_dict, self.lock_file)
s.start()
time.sleep(2)
self.main()
- elif deefuzzer_pid != [] and os.path.exists(self.lock_file) and not form.has_key("action"):
+ 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)
- form.stop_form(self.conference_dict, writing, casting)
+ self.form.stop_form(self.conference_dict, writing, casting)
self.logger.write_info('page stop')
- elif deefuzzer_pid and form.has_key("action") and form["action"].value == "stop":
+ elif deefuzzer_pid and self.form.has_key("action") and self.form["action"].value == "stop":
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)
self.main()
elif deefuzzer_pid == []:
- form.start_form(writing, casting)
+ self.form.start_form(writing, casting)
self.logger.write_info('page start')
print "<link href=\"/telecaster/css/telecaster.css\" rel=\"stylesheet\" type=\"text/css\">"
+ def javascript(self):
print '<script language="Javascript" type="text/javascript" >'
print 'function choix(formulaire)'
print '{var j; var i = formulaire.department.selectedIndex;'
#print " getRSS(url)"
#print " setTimeout(\"rss_reload(\'\" + url + \"\')\", 10000);}"
#print "</script>"
-
+
+ def sub_header(self):
if self.refresh:
print "<meta http-equiv=\"refresh\" content=\"" + str(self.refresh_value) + "; URL=telecaster.py\">"
-
print "</HEAD>\n"
-
#print "<BODY bgcolor =\"#ffffff\" onload=\"rss_reload(\'" + self.rss_url + "\');\">"
print "<BODY>"
print "<div class=\"bg\">"
print "<div class=\"header\">"
- print "<img src=\"img/logo_telecaster_wh.png\">"
+ print "<img src=\"img/logo_telecaster_wh.png\" alt=\"logo_telecaster\">"
print "<div class=\"title_main\"> TeleCaster - Audio Web Live Recording</div>"
print "</div>"
pass
print "<tr><td>JACK audio server</td><TD> : </TD>"
print "<td>%s</td></tr>" % jackd_info
- print "<td><div class=\"buttons\">"
+ print "<tr><td><div class=\"buttons\">"
if self.writing:
- print "<button type=\"submit\" class=\"positive\"><img src=\"img/drive_add.png\" alt=\"\">Recording...</button>"
+ print "<button class=\"positive\"><img src=\"img/drive_add.png\" alt=\"\">Recording...</button>"
else:
- print "<button type=\"submit\" class=\"negative\"><img src=\"img/drive_error.png\" alt=\"\">NOT Recording !</button>"
- print "</div></td><TD> </TD><td><div class=\"buttons\">"
+ print "<button class=\"negative\"><img src=\"img/drive_error.png\" alt=\"\">NOT Recording !</button>"
+ print "</div></td>"
+ print "<TD> </TD>"
+ print "<td><div class=\"buttons\">"
if self.casting:
- print "<button type=\"submit\" class=\"positive\"><img src=\"img/transmit_add.png\" alt=\"\">Diffusing...</button>"
+ print "<button class=\"positive\"><img src=\"img/transmit_add.png\" alt=\"\">Diffusing...</button>"
else:
- print "<button type=\"submit\" class=\"negative\"><img src=\"img/transmit_error.png\" alt=\"\">NOT Diffusing !</button>"
+ print "<button class=\"negative\"><img src=\"img/transmit_error.png\" alt=\"\">NOT Diffusing !</button>"
print "</div>"
+ print "</td></tr>"
print "</table>"
print "</div>"
self.refresh = False
self.header()
+ self.javascript()
+ self.sub_header()
self.hardware_data()
- print "<form method=\"post\" action=\"telecaster.py\" name=\"formulaire\">"
+ print "<form method=\"POST\" action=\"telecaster.py\" name=\"formulaire_start\">"
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 selected>...........Choisissez un département...........</option>"
+ print "<option value=\"unknown\">...........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 selected>...........Choisissez une conférence...........</option>"
+ print "<option value=\"unknown\">...........Choisissez une conférence...........</option>"
for i in range(1,self.conference_nb_max):
print "<option></option>"
print "</select></TD></TR>"
self.refresh = True
self.header()
+ self.sub_header()
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>"
print "</table>"
print "</div>"
print "<div class=\"tools\">"
- print "<form method=\"post\" action=\"telecaster.py\">"
print "<div class=\"buttons\">"
- print "<button type=\"submit\"><img src=\"img/arrow_refresh.png\" alt=\"\">Refresh</button>"
+ print "<button><img src=\"img/arrow_refresh.png\" alt=\"\">Refresh</button>"
print "<a href=\"http://"+self.url+":"+self.port+"/"+self.mount_point+"\"><img src=\"img/control_play_blue.png\" alt=\"\">Play</a>"
print "<button type=\"submit\" name=\"action\" value=\"stop\" class=\"negative\"><img src=\"img/cancel.png\" alt=\"\">Stop</button>"
print "<a href=\"http://"+self.url+"/archives/\"><img src=\"img/folder_go.png\" alt=\"\">Archives</a>"
print "<a href=\"http://"+self.url+"/trash/\"><img src=\"img/bin.png\" alt=\"\">Trash</a>"
print "</div>"
- print "</form>"
print "</div>"
+ print "</form>"
self.colophon()
self.footer()