]> git.parisson.com Git - deefuzzer.git/commitdiff
get right bitrate and length, cleanup strings, update to 0.3.1
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 4 May 2009 09:38:59 +0000 (09:38 +0000)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 4 May 2009 09:38:59 +0000 (09:38 +0000)
deefuzzer.py
install.py
tools/mp3.py

index e5902e0f3252329999ac9f65ec01f31c81b2fc27..ee5cf0376bcb94c3d029930dcb3f480a8ae48609 100755 (executable)
@@ -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 <yomguy@parisson.com>
+    desc = """ deefuzzer : easy and instant media streaming tool
+ version : %s
+ running on system : %s
+
+ Copyright (c) 2007-%s Guillaume Pellerin <yomguy@parisson.com>
  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 = '<table>'
+            media_description_item = '<tr><td>%s:   </td><td><b>%s</b></td></tr>'
             for key in media.metadata.keys():
                 if media.metadata[key] != '':
-                    media_description += '<tr><td>%s:   </td><td><b>%s</b></td></tr>' % \
-                                            (key.capitalize(), media.metadata[key])
-            media_description += '<tr><td>%s:   </td><td><b>%s</b></td></tr>' % \
-                                            ('Duration', str(media.length).split('.')[0])
-            media_description += '<tr><td>%s:   </td><td><b>%s</b></td></tr>' % \
-                                            ('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 += '</table>'
             media_stats = os.stat(media.media)
             media_date = time.localtime(media_stats[8])
index e09bdfa128039f471640194de5020fddaf2da430..fb7fac1fb2fd7a7109afeacdbda7f1c3f1a079a3 100644 (file)
@@ -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...
    """
 
index d79916c986d52901b419e084241dbb1078458525..760797e1d95bcfac833c15269cd7834ceb2b6a13 100644 (file)
@@ -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()