From be4b37b2e2416e5831b36e5721b146dba7d4ff20 Mon Sep 17 00:00:00 2001
From: yomguy <>
Date: Mon, 26 Nov 2007 17:51:06 +0000
Subject: [PATCH] Bug Fixes
---
pre-barreau.xml | 195 ++++++++++++++++++------------------------------
teleoddcast.cfg | 8 +-
teleoddcast.py | 125 +++++++++++++++----------------
teleoddcast.xml | 4 +-
tools.py | 9 +++
5 files changed, 145 insertions(+), 196 deletions(-)
diff --git a/pre-barreau.xml b/pre-barreau.xml
index e48b49f..20940f6 100644
--- a/pre-barreau.xml
+++ b/pre-barreau.xml
@@ -1,256 +1,203 @@
http://augustins.pre-barreau.com
-
+ Augustins - Pre-Barreau
+
CRFPA
- Liberté publiques - Cours
-
+ Liberté publiques - Cours
- Note de synthèse - Corrections
-
+ Note de synthèse - Corrections
- Droit civil - Cours
-
+ Droit civil - Cours
- Droit civil - Corrections
-
+ Droit civil - Corrections
- Procédure administrative et contentieuse - Cours
-
+ Procédure administrative et contentieuse - Cours
- Procédure administrative et contentieuse - Corrections
-
+ Procédure administrative et contentieuse - Corrections
- Procédure civile - Cours
-
+ Procédure civile - Cours
- Procédure civile - Corrections
-
+ Procédure civile - Corrections
- Procédure pénale - Cours
-
+ Procédure pénale - Cours
- Procédure pénale - Corrections
-
+ Procédure pénale - Corrections
- Droit commercial des affaires - Cours
-
+ Droit commercial des affaires - Cours
- Droit commercial des affaires - Corrections
-
+ Droit commercial des affaires - Corrections
- Droit communautaire et européen - Cours
-
+ Droit communautaire et européen - Cours
- Droit communautaire et européen - Corrections
-
+ Droit communautaire et européen - Corrections
- Droit fiscal - Cours
-
+ Droit fiscal - Cours
- Droit fiscal - Corrections
-
+ Droit fiscal - Corrections
- Droit pénal - Cours
-
+ Droit pénal - Cours
- Droit pénal - Corrections
-
+ Droit pénal - Corrections
- Droit de la famille et des personnes - Cours
-
+ Droit de la famille et des personnes - Cours
- Droit de la famille et des personnes - Corrections
-
+ Droit de la famille et des personnes - Corrections
- Droit patrimonial - Cours
-
+ Droit patrimonial - Cours
- Droit patrimonial - Corrections
-
+ Droit patrimonial - Corrections
- Droit du travail - Cours
-
+ Droit du travail - Cours
- Droit du travail - Corrections
-
+ Droit du travail - Corrections
- Droit administratif - Cours
-
+ Droit administratif - Cours
- Droit administratif - Corrections
-
+ Droit administratif - Corrections
- Droit public des activités économiques - Cours
-
+ Droit public des activités économiques - Cours
- Droit public des activités économiques - Corrections
-
+ Droit public des activités économiques - Corrections
- Droit international privé - Cours
-
+ Droit international privé - Cours
- Droit international privé - Corrections
-
+ Droit international privé - Corrections
- Procédures collectives et sûretés - Cours
-
+ Procédures collectives et sûretés - Cours
- Procédures collectives et sûretés - Corrections
-
+ Procédures collectives et sûretés - Corrections
- Procédure communautaire - Cours
-
+ Procédure communautaire - Cours
- Procédures civile d'exécution - Cours
-
+ Procédures civile d'exécution - Cours
- Comptabilité privée - Cours
-
+ Comptabilité privée - Cours
- Finances publiques - Cours
-
+ Finances publiques - Cours
- REUNION
-
+ REUNION
- TEST
-
+ TEST
-
+
-
+
AE
-
-
+ Administratif_Cours
- Administratif_Cours
-
+ Adm_Correction
- Adm_Correction
-
+ Civil_Correction
- Civil_Correction
-
+ Commercial_Correctio
- Commercial_Correctio
-
+ Commercial_Cours
- Commercial_Cours
-
+ Deontologie_Cours
- Deontologie_Cours
-
+ Droit civil - Cours
- Droit civil - Cours
-
+ Methodo_Oraux
- Methodo_Oraux
-
+ Penal_Correction
- Penal_Correction
-
+ Penal_Cours
- Penal_Cours
-
+ Procedures_Cours
- Procedures_Cours
-
+ Reunion_info
- Reunion_info
-
+ Social_Corrections
- Social_Corrections
-
+ Social_Cours
- Social_Cours
-
+ REUNION
- REUNION
-
-
-
- TEST
-
+ TEST
-
+
-
+
ENM
- TEST
-
+ TEST
+
+
+ REUNION
-
+
-
+
FJP
- TEST
-
+ TEST
+
+
+ REUNION
-
+
diff --git a/teleoddcast.cfg b/teleoddcast.cfg
index d8c19db..539d6b5 100644
--- a/teleoddcast.cfg
+++ b/teleoddcast.cfg
@@ -1,7 +1,7 @@
Server=localhost
Port=8000
-ServerPassword=streampreb
-ServerMountpoint=/Pre-barreau_-_Augustins_-_CRFPA_-_Droit_civil_-_Corrections.ogg
+ServerPassword=source2parisson
+ServerMountpoint=/My_best_funky_station_-_AE_-_Civil_Correction.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=Pre-barreau_-_Augustins_-_CRFPA_-_Droit_civil_-_Corrections_-_1
-ServerDescription=Pre-barreau_-_Augustins_-_CRFPA_-_Droit_civil_-_Corrections_-_1_-_edfez_-_ezf
+ServerName=My_best_funky_station_-_AE_-_Civil_Correction_-_1
+ServerDescription=My_best_funky_station_-_AE_-_Civil_Correction_-_1_-_sf_-_ze
ServerGenre=Teaching
#Advanced Settings
LogLevel=1
diff --git a/teleoddcast.py b/teleoddcast.py
index 388983d..6463568 100755
--- a/teleoddcast.py
+++ b/teleoddcast.py
@@ -36,11 +36,11 @@ class Course:
"""A course in a class room"""
def __init__(self, dict):
- self.department = course_dict['department']
- self.course = course_dict['course']
- self.session = course_dict['session']
- self.professor = course_dict['professor']
- self.comment = course_dict['comment']
+ self.department = dict['department']
+ self.course = dict['course']
+ self.session = dict['session']
+ self.professor = dict['professor']
+ self.comment = dict['comment']
def get_info(self):
return self.title, self.department, self.course, self.session, self.professor, self.comment
@@ -61,25 +61,19 @@ class TeleOddCast(Course):
self.port = self.conf['server']['port']
self.password = self.conf['server']['sourcepassword']
self.url = 'http://'+self.host+':'+self.port
- self.uid = os.getuid()
- self.odd_pid = get_pid('^oddcastv3 -n [^LIVE]', self.uid)
- self.rip_pid = get_pid('streamripper ' + self.url + self.mount_point, self.uid)
self.odd_conf_file = self.conf['server']['odd_conf_file']
- self.ServerDescription = clean_string('_-_'.join(self.title,
- self.department,
- self.course,
- self.session,
- self.professor,
- self.comment))
- self.ServerName = clean_string('_-_'.join(self.title,
- self.department,
- self.course,
- self.session))
+ self.description = [self.title, self.department, self.course, self.session, self.professor, self.comment]
+ self.server_name = [self.title, self.department, self.course, self.session]
+ self.ServerDescription = clean_string('_-_'.join(self.description))
+ self.ServerName = clean_string('_-_'.join(self.server_name))
self.mount_point = '/' + clean_string(self.title) + '_-_' + \
clean_string(self.department) + '_-_' + \
clean_string(self.course)+'.ogg'
self.lock_file = self.root_dir + self.ServerDescription + '.lock'
self.filename = self.ServerDescription + '.ogg'
+ self.uid = os.getuid()
+ self.odd_pid = get_pid('^oddcastv3 -n [^LIVE]', self.uid)
+ self.rip_pid = get_pid('streamripper ' + self.url + self.mount_point, self.uid)
def set_oddcast_conf(self):
@@ -114,16 +108,10 @@ class TeleOddCast(Course):
os.system(command)
self.set_lock()
time.sleep(1)
- return mount_point
def set_lock(self):
lock = open(self.lock_file,'w')
- lock_text = clean_string('_*_'.join(self.title,
- self.department,
- self.course,
- self.session,
- self.professor,
- self.comment))
+ lock_text = clean_string('_*_'.join(self.description))
lock_text = lock_text.replace('\n','')
lock.write(lock_text)
lock.close()
@@ -149,7 +137,7 @@ class TeleOddCast(Course):
time.sleep(1)
date = datetime.datetime.now().strftime("%Y")
dirname = self.media_dir + os.sep + self.department + os.sep + \
- clean_string('_-_'.join(self.title, self.department, self.course, self.session))
+ clean_string('_-_'.join(self.server_name))
if os.path.exists(dirname) and os.path.exists(dirname+os.sep+'incomplete'):
shutil.move(dirname+os.sep+'incomplete'+os.sep+' - .ogg',dirname+os.sep)
@@ -158,7 +146,7 @@ class TeleOddCast(Course):
def write_tags(self):
date = datetime.datetime.now().strftime("%Y")
- new_title = clean_string('_-_'.join(self.title, self.department, self.course, self.session)
+ new_title = clean_string('_-_'.join(self.server_name))
dirname = self.media_dir + os.sep + self.department + os.sep + new_title
if os.path.exists(dirname+os.sep+self.filename):
audio = OggVorbis(dirname+os.sep+self.filename)
@@ -191,8 +179,11 @@ class WebView:
self.conf = xml2dict(school_file)
self.conf = self.conf['teleoddcast']
self.url = self.conf['url']
- self.departments = self.conf['department']['name']
- self.len_departments = str(len(self.departments))
+ self.title = self.conf['title']
+ self.departments = self.conf['department']
+ #print self.departments
+ #self.courses = self.conf['department']['courses']
+ self.len_departments = len(self.departments)
def header(self):
# Required header that tells the browser how to render the HTML.
@@ -205,24 +196,29 @@ class WebView:
print 'function choix(formulaire)'
print '{var j; var i = formulaire.department.selectedIndex;'
print 'if (i == 0)'
- print 'for(j = 1; j < '+ self.len_departments + '; j++)'
+ print 'for(j = 1; j < '+ str(self.len_departments) + '; j++)'
print 'formulaire.course.options[j].text="";'
- print 'formulaire.course.options[j].value="";'
+ #print 'formulaire.course.options[j].value="";'
print 'else{'
print ' switch (i){'
- for k in range(1,self.len_departments)
+ for k in range(0,self.len_departments):
department = self.departments[k]
- courses = dict2tuple(department['courses'])
- print ' case '+k+' : var text = new Array('+courses+'); '
+ courses = department['courses']
+ #print courses
+ courses_t = dict2tuple(courses)
+ #print courses
+ courses = '"'+'","'.join(courses_t)+'"'
+ print ' case '+str(k+1)+' : var text = new Array('+courses+'); '
print ' break;'
print ' }'
- print ' for(j = 0; j<'+self.len_departments+'; j++)'
- print ' formulaire.course.options[j+1].text=text[j];}'
- print ' formulaire.course.options[j+1].value=text[j];}'
+ print ' for(j = 0; j<50; j++)'
+ print ' formulaire.course.options[j+1].text=text[j];'
+ #print ' formulaire.course.options[j+1].value=text[j];'
+ print '}'
print ' formulaire.course.selectedIndex=0;}'
print ''
-
print ""
+
print "
"
print ""
print "