From: yomguy Date: Mon, 20 Oct 2008 22:38:51 +0000 (+0000) Subject: Add nice buttons, try to fix refresh, cleanup X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e8c9a7cfe294054d3baa4bf0ea152b92bb8335a5;p=telecaster-cgi.git Add nice buttons, try to fix refresh, cleanup --- diff --git a/css/telecaster.css b/css/telecaster.css index f0a874a..d66634d 100644 --- a/css/telecaster.css +++ b/css/telecaster.css @@ -30,6 +30,7 @@ div.tools { background-color: #030250; border: 1px solid #FFFFFF; padding:0.5em; margin: 0; + height: 32px; } div.colophon { background-color: #FFFFFF; @@ -66,3 +67,88 @@ div.form { background-color: #FFFFFF; margin: 0; } +/* BUTTONS */ + +.buttons a, .buttons button{ + display:block; + float:left; + margin:0 7px 0 0; + background-color:#f5f5f5; + border:1px solid #dedede; + border-top:1px solid #eee; + border-left:1px solid #eee; + + font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; + font-size:100%; + line-height:130%; + text-decoration:none; + font-weight:bold; + color:#565656; + cursor:pointer; + padding:5px 10px 6px 7px; /* Links */ +} +.buttons button{ + width:auto; + overflow:visible; + padding:4px 10px 3px 7px; /* IE6 */ +} +.buttons button[type]{ + padding:5px 10px 5px 7px; /* Firefox */ + line-height:17px; /* Safari */ +} +*:first-child+html button[type]{ + padding:4px 10px 3px 7px; /* IE7 */ +} +.buttons button img, .buttons a img{ + margin:0 3px -3px 0 !important; + padding:0; + border:none; + width:16px; + height:16px; +} + + +/* STANDARD */ + +button:hover, .buttons a:hover{ + background-color:#dff4ff; + border:1px solid #c2e1ef; + color:#336699; +} +.buttons a:active{ + background-color:#6299c5; + border:1px solid #6299c5; + color:#fff; +} + +/* POSITIVE */ + +button.positive, .buttons a.positive{ + color:#529214; +} +.buttons a.positive:hover, button.positive:hover{ + background-color:#E6EFC2; + border:1px solid #C6D880; + color:#529214; +} +.buttons a.positive:active{ + background-color:#529214; + border:1px solid #529214; + color:#fff; +} + +/* NEGATIVE */ + +.buttons a.negative, button.negative{ + color:#d12f19; +} +.buttons a.negative:hover, button.negative:hover{ + background:#fbe3e4; + border:1px solid #fbc2c4; + color:#d12f19; +} +.buttons a.negative:active{ + background-color:#d12f19; + border:1px solid #d12f19; + color:#fff; +} diff --git a/etc/telecaster_mp3.cfg b/etc/telecaster_mp3.cfg index a12c9a5..633ffee 100644 --- a/etc/telecaster_mp3.cfg +++ b/etc/telecaster_mp3.cfg @@ -14,7 +14,7 @@ ExternalFile=/tmp/test #YP Settings ServerStreamURL=http://www.pre-barreau.com ServerName=Pre-Barreau_-_ICP_-_AE_-_Adm_Correction -ServerDescription=Pre-Barreau_-_ICP_-_AE_-_Adm_Correction_-_3_-_GIUSTINIANI_G._-_2e_cours +ServerDescription=Pre-Barreau_-_ICP_-_AE_-_Adm_Correction_-_2_-_GIUSTINIANI_G._-_1er_cours ServerGenre=Teaching #Advanced Settings LogLevel=1 diff --git a/img/accept.png b/img/accept.png new file mode 100644 index 0000000..89c8129 Binary files /dev/null and b/img/accept.png differ diff --git a/img/bin.png b/img/bin.png new file mode 100644 index 0000000..ebad933 Binary files /dev/null and b/img/bin.png differ diff --git a/img/cancel.png b/img/cancel.png new file mode 100644 index 0000000..c149c2b Binary files /dev/null and b/img/cancel.png differ diff --git a/img/control_pause_blue.png b/img/control_pause_blue.png new file mode 100644 index 0000000..ec61099 Binary files /dev/null and b/img/control_pause_blue.png differ diff --git a/img/control_play_blue.png b/img/control_play_blue.png new file mode 100644 index 0000000..f8c8ec6 Binary files /dev/null and b/img/control_play_blue.png differ diff --git a/img/control_stop.png b/img/control_stop.png new file mode 100644 index 0000000..893bb60 Binary files /dev/null and b/img/control_stop.png differ diff --git a/img/control_stop_blue.png b/img/control_stop_blue.png new file mode 100644 index 0000000..e6f75d2 Binary files /dev/null and b/img/control_stop_blue.png differ diff --git a/img/drive_add.png b/img/drive_add.png new file mode 100644 index 0000000..29a35d5 Binary files /dev/null and b/img/drive_add.png differ diff --git a/img/drive_burn.png b/img/drive_burn.png new file mode 100644 index 0000000..80fd79f Binary files /dev/null and b/img/drive_burn.png differ diff --git a/img/drive_delete.png b/img/drive_delete.png new file mode 100644 index 0000000..e6eb186 Binary files /dev/null and b/img/drive_delete.png differ diff --git a/img/drive_error.png b/img/drive_error.png new file mode 100644 index 0000000..309f639 Binary files /dev/null and b/img/drive_error.png differ diff --git a/img/folder_go.png b/img/folder_go.png new file mode 100644 index 0000000..34a736f Binary files /dev/null and b/img/folder_go.png differ diff --git a/img/folder_link.png b/img/folder_link.png new file mode 100644 index 0000000..b9b75f6 Binary files /dev/null and b/img/folder_link.png differ diff --git a/img/ipod_cast.png b/img/ipod_cast.png new file mode 100644 index 0000000..6f6d340 Binary files /dev/null and b/img/ipod_cast.png differ diff --git a/img/stop.png b/img/stop.png new file mode 100644 index 0000000..0cfd585 Binary files /dev/null and b/img/stop.png differ diff --git a/img/tick.png b/img/tick.png new file mode 100644 index 0000000..a9925a0 Binary files /dev/null and b/img/tick.png differ diff --git a/img/transmit.png b/img/transmit.png new file mode 100644 index 0000000..f54bf73 Binary files /dev/null and b/img/transmit.png differ diff --git a/img/transmit_add.png b/img/transmit_add.png new file mode 100644 index 0000000..b7fd4e6 Binary files /dev/null and b/img/transmit_add.png differ diff --git a/img/transmit_blue.png b/img/transmit_blue.png new file mode 100644 index 0000000..7b1142f Binary files /dev/null and b/img/transmit_blue.png differ diff --git a/img/transmit_delete.png b/img/transmit_delete.png new file mode 100644 index 0000000..3d72be2 Binary files /dev/null and b/img/transmit_delete.png differ diff --git a/img/transmit_edit.png b/img/transmit_edit.png new file mode 100644 index 0000000..eb9a3dd Binary files /dev/null and b/img/transmit_edit.png differ diff --git a/img/transmit_error.png b/img/transmit_error.png new file mode 100644 index 0000000..fd1d449 Binary files /dev/null and b/img/transmit_error.png differ diff --git a/img/transmit_go.png b/img/transmit_go.png new file mode 100644 index 0000000..10137e5 Binary files /dev/null and b/img/transmit_go.png differ diff --git a/img/tux.png b/img/tux.png new file mode 100644 index 0000000..bbefe2e Binary files /dev/null and b/img/tux.png differ diff --git a/telecaster.py b/telecaster.py index eebb7e7..0741eae 100755 --- a/telecaster.py +++ b/telecaster.py @@ -34,6 +34,7 @@ import string import signal import unicodedata from tools import * +from cgi import FieldStorage from tempfile import NamedTemporaryFile from mutagen.oggvorbis import OggVorbis from mutagen.id3 import ID3, TIT2, TP1, TAL, TDA, TCO, COM @@ -103,7 +104,7 @@ class Station(Conference): os.makedirs(self.raw_dir) def set_oddcast_conf(self): - oddconf_temp = NamedTemporaryFile(suffix='.cfg') + #oddconf_temp = NamedTemporaryFile(suffix='.cfg') oddconf = open(self.odd_conf_file,'r') lines = oddconf.readlines() oddconf.close() @@ -128,9 +129,10 @@ class Station(Conference): else: newlines.append(line) - oddconf_temp_file = open(oddconf_temp.name,'w') - oddconf_temp_file.writelines(newlines) - self.odd_conf = oddconf_temp.name + oddconf = open(self.odd_conf_file,'w') + oddconf.writelines(newlines) + oddconf.close() + self.odd_conf = self.odd_conf_file def start_oddcast(self): command = 'oddcastv3 -n "'+clean_string(self.conference)[0:16]+'" -c '+self.odd_conf+ \ @@ -271,10 +273,11 @@ class Station(Conference): os.system('rsync -a '+self.media_dir+os.sep+' '+self.rsync_host+':'+os.sep+hostname+os.sep) -class WebView: +class WebView(FieldStorage): """Gives the web CGI frontend""" def __init__(self, school_file): + FieldStorage.__init__(self) self.conf = xml2dict(school_file) self.conf = self.conf['telecaster'] self.interfaces = ['eth0', 'eth1', 'eth2'] @@ -417,12 +420,12 @@ class WebView: self.refresh = False self.header() self.hardware_data() + print "
" print "
" #print "
"+message+"
" #print "
Attention, il est important de remplir tous les champs, y compris le commentaire !
" print "
" - print "" - print "" + print "
" print "" print "" print "" - - print "
Titre :"+self.title+"
Département :
" + print "" print "
" #print "
Cliquez ici pour écouter le flux continu 24/24 en direct
" - print '
' - print "
Cliquez ici pour accéder aux archives
" - print "
Cliquez ici pour accéder aux archives de secours
" + print "
" print "
" - print "" - print "" - print "" + print "
" + #print "" + print "" + print "\"\"/Archives" + print "\"\"/Corbeille" + #print "" print "
" + print "
" + print "" self.colophon() self.footer() @@ -493,35 +498,35 @@ class WebView: self.header() self.hardware_data() print "
" - - print "
" - if writing: - print "

Enregistrement en cours...

" - else: - print "

PAS d'enregistrement en cours !

" - print '
' - if casting: - print "

Diffusion en cours...

" - else: - print "

PAS de diffusion en cours !

" - print "
" - print "" + print "
" print "" print "" print "" print "" print "" print "" - print "
Titre :"+self.title+"
Département :"+department+"
Conference :"+conference+"
Session :"+session+"
Professeur :"+professor+"
Commentaire :"+comment+"
" - print "
" - print "
Cliquez ici pour écouter cette formation en direct
" + print "" + #print "
Cliquez ici pour écouter cette formation en direct
" print "
" + print "
" print "
" - print "" - print "" - print "" - print "" + print "
" + if writing: + print "" + + #print "" + #print "" print "
" + print "
" + print "" self.colophon() self.footer() @@ -546,14 +551,10 @@ class TeleCaster: odd_pid = get_pid('^oddcastv3 -n [^LIVE]', self.uid) rip_pid = get_pid('streamripper ', self.uid) writing = False - casting = True - if rip_pid != []: - writing = True - if odd_pid == []: - casting = False - - w = WebView(self.school_file) - form = cgi.FieldStorage() + casting = False + writing = rip_pid != [] + casting = odd_pid != [] + form = WebView(self.school_file) if odd_pid == [] and form.has_key("action") and \ form.has_key("department") and form.has_key("conference") and \ @@ -561,37 +562,32 @@ class TeleCaster: form["action"].value == "start": self.conference_dict = {'title': self.title, - 'department': form["department"].value, - 'conference': form["conference"].value, - 'session': form["session"].value, - 'professor': form["professor"].value, - 'comment': form["comment"].value} + 'department': form.getfirst("department"), + 'conference': form.getfirst("conference"), + 'session': form.getfirst("session"), + 'professor': form.getfirst("professor"), + 'comment': form.getfirst("comment")} s = Station(self.conf_file, self.conference_dict, self.lock_file) s.start() - if get_pid('^oddcastv3 -n [^LIVE]', self.uid) != []: - casting = True - if get_pid('streamripper ', self.uid) == []: - writing = False - w.stop_form(self.conference_dict, writing, casting) + time.sleep(1) + #w.stop_form(self.conference_dict, writing, casting) + self.main() elif odd_pid != [] and os.path.exists(self.lock_file) and not form.has_key("action"): self.conference_dict = get_conference_from_lock(self.lock_file) - if get_pid('^oddcastv3 -n [^LIVE]', self.uid) != []: - casting = True - if get_pid('streamripper ', self.uid) == []: - writing = False - w.stop_form(self.conference_dict, writing, casting) + form.stop_form(self.conference_dict, writing, casting) elif odd_pid != [] and form.has_key("action") and 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) s.stop() - w.start_form() + time.sleep(1) + self.main() elif odd_pid == []: - w.start_form() + form.start_form() # Call main function.