From 3c3cf7dab62a38a4520435125c5b4d74c1773b33 Mon Sep 17 00:00:00 2001 From: yomguy Date: Thu, 4 Feb 2010 15:29:15 +0000 Subject: [PATCH] fix utf8, jack ports --- etc/telecaster_mp3.cfg | 2 +- station.py | 33 +++++++++++++++++---------------- tools/tools.py | 4 ++-- webview.py | 18 +++++++++++------- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/etc/telecaster_mp3.cfg b/etc/telecaster_mp3.cfg index eee50e2..1068f8f 100644 --- a/etc/telecaster_mp3.cfg +++ b/etc/telecaster_mp3.cfg @@ -8,7 +8,7 @@ Encode=MP3 Lame BitrateNominal=96 OggQuality=3 NumberChannels=2 -Samplerate=44100 +Samplerate=48000 ServerType=Icecast2 ExternalFile=/tmp/test #YP Settings diff --git a/station.py b/station.py index e77c359..1fdd690 100644 --- a/station.py +++ b/station.py @@ -25,6 +25,7 @@ import os import shutil import datetime import time +import urllib import codecs import string import signal @@ -201,14 +202,14 @@ class Station(Conference): file = self.file_dir + os.sep + self.filename if os.path.exists(file): audio = OggVorbis(file) - audio['TITLE'] = self.new_title - audio['ARTIST'] = self.professor - audio['ALBUM'] = self.title - audio['DATE'] = self.date - audio['GENRE'] = self.genre - audio['SOURCE'] = self.title - audio['ENCODER'] = self.encoder - audio['COMMENT'] = self.comment + audio['TITLE'] = self.new_title.decode('utf8') + audio['ARTIST'] = self.professor.decode('utf8') + audio['ALBUM'] = self.title.decode('utf8') + audio['DATE'] = self.date.decode('utf8') + audio['GENRE'] = self.genre.decode('utf8') + audio['SOURCE'] = self.title.decode('utf8') + audio['ENCODER'] = self.encoder.decode('utf8') + audio['COMMENT'] = self.comment.decode('utf8') audio.save() def write_tags_mp3(self): @@ -217,15 +218,15 @@ class Station(Conference): os.system('mp3info -t "a" -a "a" '+file) audio = ID3(file) #tag = tags.__dict__['TITLE'] - audio.add(TIT2(encoding=3, text=self.new_title)) + audio.add(TIT2(encoding=3, text=self.new_title.decode('utf8'))) #tag = tags.__dict__['ARTIST'] - audio.add(TP1(encoding=3, text=self.professor)) + audio.add(TP1(encoding=3, text=self.professor.decode('utf8'))) #tag = tags.__dict__['ALBUM'] - audio.add(TAL(encoding=3, text=self.title)) + audio.add(TAL(encoding=3, text=self.title.decode('utf8'))) #tag = tags.__dict__['DATE'] - audio.add(TDA(encoding=3, text=self.date)) + audio.add(TDA(encoding=3, text=self.date.decode('utf8'))) #tag = tags.__dict__['GENRE'] - audio.add(TCO(encoding=3, text=self.genre)) + audio.add(TCO(encoding=3, text=self.genre.decode('utf8'))) #tag = tags.__dict__['COMMENT'] #audio.add(COM(encoding=3, text=self.comment)) audio.save() @@ -323,6 +324,6 @@ class Station(Conference): lastBuildDate = str(time_now), items = rss_item_list,) - f = open(self.rss_dir + os.sep + self.rss_file, 'w') - rss.write_xml(f, 'utf-8') - f.close() + #f = open(self.rss_dir + os.sep + self.rss_file, 'w') + #rss.write_xml(f, 'utf-8') + #f.close() diff --git a/tools/tools.py b/tools/tools.py index 9e84050..9527f6b 100644 --- a/tools/tools.py +++ b/tools/tools.py @@ -50,8 +50,8 @@ def get_lines(file): def clean_string(string): """removes blank spaces and accents""" string = string.replace(' ','_') - string = string.replace('é','e') - string = string.replace('è','e') + #string = string.replace('é','e') + #string = string.replace('è','e') return string def xml2dict(conf_file): diff --git a/webview.py b/webview.py index 192263e..b16aab3 100644 --- a/webview.py +++ b/webview.py @@ -74,6 +74,7 @@ class WebView(FieldStorage): self.conference_nb_max = 40 self.professor_nb_max = 40 self.refresh = False + self.refresh_value = 20 self.uid = os.getuid() def header(self): @@ -112,16 +113,19 @@ class WebView(FieldStorage): print ' formulaire.conference.selectedIndex=0;}' print '' + # rss ajax + #print "" + #print "" - print "" - print "" if self.refresh: - print "" + print "" + print "\n" + #print "" print "" print "
" -- 2.39.5