From: Guillaume Pellerin Date: Mon, 4 May 2009 09:38:59 +0000 (+0000) Subject: get right bitrate and length, cleanup strings, update to 0.3.1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8ebdb93941a3a43a3032c841e8575d800af073bf;p=deefuzzer.git get right bitrate and length, cleanup strings, update to 0.3.1 --- diff --git a/deefuzzer.py b/deefuzzer.py index e5902e0..ee5cf03 100755 --- a/deefuzzer.py +++ b/deefuzzer.py @@ -45,22 +45,26 @@ import random import Queue import shout import subprocess +import platform from threading import Thread from tools import * -version = '0.3.0' +version = '0.3.1' year = datetime.datetime.now().strftime("%Y") +platform_system = platform.system() def prog_info(): - desc = '\n deefuzzer : easy and light streaming tool\n' - ver = ' version : %s \n\n' % (version) - info = """ Copyright (c) 2007-%s Guillaume Pellerin + desc = """ deefuzzer : easy and instant media streaming tool + version : %s + running on system : %s + + Copyright (c) 2007-%s Guillaume Pellerin All rights reserved. This software is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms - are also available at http://svn.parisson.org/d-fuzz/DeeFuzzerLicense + are also available at http://svn.parisson.org/deefuzzer/DeeFuzzerLicense depends : python, python-xml, python-shout, libshout3, icecast2 recommends : python-mutagen @@ -71,9 +75,9 @@ def prog_info(): ex: deefuzzer example/myfuzz.xml see http://svn.parisson.org/deefuzzer/ for more details - """ % (year) - text = desc + ver + info - return text + """ + + return desc % (version, platform_system, year) class DeeFuzzerError: @@ -227,8 +231,9 @@ class Station(Thread): self.channel.genre = self.station['infos']['genre'] self.channel.description = self.station['infos']['description'] self.channel.url = self.station['infos']['url'] - self.rss_current_file = self.rss_dir + os.sep + self.short_name + '_' + self.channel.format + '_current.xml' - self.rss_playlist_file = self.rss_dir + os.sep + self.short_name + '_' + self.channel.format + '_playlist.xml' + self.base_name = self.rss_dir + os.sep + self.short_name + '_' + self.channel.format + self.rss_current_file = self.base_name + '_current.xml' + self.rss_playlist_file = self.base_name + '_playlist.xml' self.m3u_playlist_file = self.rss_dir + os.sep + self.short_name + '.m3u' self.media_url_dir = '/media/' # Server @@ -265,14 +270,12 @@ class Station(Thread): for media in media_list: media_description = '' + media_description_item = '' for key in media.metadata.keys(): if media.metadata[key] != '': - media_description += '' % \ - (key.capitalize(), media.metadata[key]) - media_description += '' % \ - ('Duration', str(media.length).split('.')[0]) - media_description += '' % \ - ('Bitrate', str(media.bitrate) + ' kbps') + media_description += media_description_item % (key.capitalize(), media.metadata[key]) + media_description += media_description_item % ('Duration', str(media.length).split('.')[0]) + media_description += media_description_item % ('Bitrate', str(media.bitrate) + ' kbps') media_description += '
%s: %s
%s: %s
%s: %s
%s: %s
' media_stats = os.stat(media.media) media_date = time.localtime(media_stats[8]) diff --git a/install.py b/install.py index e09bdfa..fb7fac1 100644 --- a/install.py +++ b/install.py @@ -41,7 +41,7 @@ import os, sys if len(sys.argv) == 1: - install_dir = '/usr/share/deefuzz/' + install_dir = '/usr/share/deefuzzer/' elif len(sys.argv) > 2: sys.exit('Give just one directory to install Telemeta, or none.') else: @@ -53,14 +53,14 @@ if not os.path.exists(install_dir): os.system('cp -ra ./* '+install_dir+os.sep) os.system('rm -rf '+install_dir+os.sep+'debian') -if os.path.exists('/usr/bin/deefuzz'): - os.system('rm -r /usr/bin/deefuzz') +if os.path.exists('/usr/bin/deefuzzer'): + os.system('rm -r /usr/bin/deefuzzer') -os.system('ln -s '+install_dir+os.sep+'deefuzz.py '+'/usr/bin/deefuzz') -os.system('ln -s '+install_dir+os.sep+'deefuzz-deamon.sh '+'/usr/bin/deefuzz-deamon') +os.system('ln -s '+install_dir+os.sep+'deefuzzer.py '+'/usr/bin/deefuzzer') +os.system('ln -s '+install_dir+os.sep+'deefuzzer-deamon.sh '+'/usr/bin/deefuzzer-deamon') print """ Installation successfull ! - Type 'deefuzz' now... + Type 'deefuzzer' now... """ diff --git a/tools/mp3.py b/tools/mp3.py index d79916c..760797e 100644 --- a/tools/mp3.py +++ b/tools/mp3.py @@ -66,7 +66,7 @@ class Mp3: } self.mp3 = MP3(self.media, ID3=EasyID3) self.info = self.mp3.info - self.bitrate = self.mp3.bitrate + self.bitrate = int(str(self.info.bitrate)[:-3]) self.length = datetime.timedelta(0,self.info.length) self.metadata = self.get_file_metadata() self.description = self.get_description()