]> git.parisson.com Git - telecaster-cgi.git/commitdiff
Add iso conv to courses but have to put utf-8 in apache
authoryomguy <yomguy@parisson.com>
Wed, 28 Nov 2007 14:57:41 +0000 (14:57 +0000)
committeryomguy <yomguy@parisson.com>
Wed, 28 Nov 2007 14:57:41 +0000 (14:57 +0000)
etc/pre-barreau.xml
etc/teleoddcast.cfg
teleoddcast.py
tools.py

index 20940f610efa1cbc119491ad394994ef37154a65..7615b84aee9567ddda6223597e21b229bd4dd91e 100644 (file)
@@ -1,6 +1,7 @@
 <teleoddcast>
     <url>http://augustins.pre-barreau.com</url>
     <title>Augustins - Pre-Barreau</title>
+    <port>8000</port>
     <department>
         <name>CRFPA</name>
         <courses>
index cc30eb8e1b5df36a201ad32b62726f50c24e0cad..05cad3342887cab9aacad1599a5e9fe0d49a2f52 100644 (file)
@@ -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
index a406dfc019b5e6ca59cd7566eba6397a36fc7750..d113f30500f4a392bf22916cac4ffa0e868b5d03 100755 (executable)
@@ -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 "<div id=\"main\">"
-        print "<h5><a href=\"http://augustins.pre-barreau.com:8000/crfpa.pre-barreau.com_live.ogg.m3u\">Cliquez ici pour &eacute;couter le flux continu 24/24 en direct</a></h5>"
+        print "<h5><a href=\""+self.url+":"+self.port+"/crfpa.pre-barreau.com_live.ogg.m3u\">Cliquez ici pour &eacute;couter le flux continu 24/24 en direct</a></h5>"
         print "\t<TABLE BORDER = 0>"
         print "\t\t<form method=post action=\"teleoddcast.py\" name=\"formulaire\">"
         print "\t\t<TR><TH align=\"left\">Titre :</TH><TD>"+self.title+"</TD></TR>"
@@ -297,7 +300,7 @@ class WebView:
         print "\t\t<TR><TH align=\"left\">Commentaire :</TH><TD>"+comment+"</TD><TR>"
         print "\t</TABLE>"
         print "<hr>"
-        print "<h5><a href=\""+self.url+"/"+clean_string(self.title)+"_-_"+clean_string(department)+"_-_"+clean_string(course)+".ogg.m3u\">Cliquez ici pour &eacute;couter cette formation en direct</a></h5>"
+        print "<h5><a href=\""+self.url+":"+self.port+"/"+clean_string(self.title)+"_-_"+clean_string(department)+"_-_"+clean_string(course)+".ogg.m3u\">Cliquez ici pour &eacute;couter cette formation en direct</a></h5>"
         print "</div>"
         print "<div id=\"tools\">"
         print "\t<INPUT TYPE = hidden NAME = \"action\" VALUE = \"stop\">"
@@ -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)
index ff83f9ad935f5f45fbd56ca69ee8554fe4f28cf5..64ca216c566069ba0454879e76246aedbdca2068 100644 (file)
--- 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()