From c7932273279aaf4112f135878ccc1425db563afe Mon Sep 17 00:00:00 2001 From: yomguy <> Date: Wed, 28 Nov 2007 14:57:41 +0000 Subject: [PATCH] Add iso conv to courses but have to put utf-8 in apache --- etc/pre-barreau.xml | 1 + etc/teleoddcast.cfg | 6 +++--- teleoddcast.py | 11 +++++++---- tools.py | 11 +++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/etc/pre-barreau.xml b/etc/pre-barreau.xml index 20940f6..7615b84 100644 --- a/etc/pre-barreau.xml +++ b/etc/pre-barreau.xml @@ -1,6 +1,7 @@ http://augustins.pre-barreau.com Augustins - Pre-Barreau + 8000 CRFPA diff --git a/etc/teleoddcast.cfg b/etc/teleoddcast.cfg index cc30eb8..05cad33 100644 --- a/etc/teleoddcast.cfg +++ b/etc/teleoddcast.cfg @@ -1,7 +1,7 @@ Server=localhost Port=8000 ServerPassword=source2parisson -ServerMountpoint=/My_station_-_AE_-_REUNION.ogg +ServerMountpoint=/My_station_-_CRFPA_-_Procédure_civile_-_Cours.ogg ServerPublic=0 AutomaticReconnectSecs=10 Encode=OggVorbis @@ -13,8 +13,8 @@ ServerType=Icecast2 ExternalFile=/home/pre-barreau/augustins/audio/ #YP Settings ServerStreamURL=http://www.pre-barreau.com -ServerName=My_station_-_AE_-_REUNION_-_1 -ServerDescription=My_station_-_AE_-_REUNION_-_1_-_azd_-_azd +ServerName=My_station_-_CRFPA_-_Procédure_civile_-_Cours_-_2 +ServerDescription=My_station_-_CRFPA_-_Procédure_civile_-_Cours_-_2_-_qgf_-_sdg ServerGenre=Teaching #Advanced Settings LogLevel=1 diff --git a/teleoddcast.py b/teleoddcast.py index a406dfc..d113f30 100755 --- a/teleoddcast.py +++ b/teleoddcast.py @@ -28,6 +28,8 @@ import cgi import shutil import datetime import time +import codecs +import string from tools import * from mutagen.oggvorbis import OggVorbis @@ -176,6 +178,7 @@ class WebView: self.conf = xml2dict(school_file) self.conf = self.conf['teleoddcast'] self.url = self.conf['url'] + self.port = self.conf['port'] self.title = self.conf['title'] self.departments = self.conf['department'] #print self.departments @@ -198,7 +201,7 @@ class WebView: #print 'formulaire.course.options[j].value="";' print 'else{' print ' switch (i){' - for k in range(0,self.len_departments): + for k in range(0, self.len_departments): department = self.departments[k] courses = department['courses'] #print courses @@ -235,7 +238,7 @@ class WebView: def start_form(self): self.header() print "
" - print "
Cliquez ici pour écouter le flux continu 24/24 en direct
" + print "
Cliquez ici pour écouter le flux continu 24/24 en direct
" print "\t" print "\t\t" print "\t\t" @@ -297,7 +300,7 @@ class WebView: print "\t\t" print "\t
Titre :"+self.title+"
Commentaire :"+comment+"
" print "
" - print "
Cliquez ici pour écouter cette formation en direct
" + print "
Cliquez ici pour écouter cette formation en direct
" print "
" print "
" print "\t" @@ -362,7 +365,7 @@ class TeleOddCast: # Call main function. conf_file = 'etc/teleoddcast.xml' -school_file = 'etc/pre-barreau.xml' +school_file = 'etc/localhost.xml' if __name__ == '__main__': t = TeleOddCast(conf_file, school_file) diff --git a/tools.py b/tools.py index ff83f9a..64ca216 100644 --- a/tools.py +++ b/tools.py @@ -24,6 +24,7 @@ import os import cgi import shutil import datetime +import string import time from xmltodict import * from mutagen.oggvorbis import OggVorbis @@ -76,6 +77,16 @@ def dict2tuple(dict): tup.append(value['name']) return tup +def dict2tuple_iso(dict): + len_dict = len(dict['course']) + if len_dict == 1: + return unicode(dict['course']['name'],'utf8').encode('iso-8859-1') + else: + tup = [] + for value in dict['course']: + tup.append(unicode(value['name'],'utf8').encode('iso-8859-1')) + return tup + def get_course_from_lock(lock_file): lockfile = open(lock_file,'r') course = lockfile.readline() -- 2.39.5