]> git.parisson.com Git - deefuzzer.git/commitdiff
readd long description, begin messages, check mimetypes before writing the playlist
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 16 Sep 2011 09:25:19 +0000 (09:25 +0000)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 16 Sep 2011 09:25:19 +0000 (09:25 +0000)
deefuzzer/tools/station.py
example/deefuzzer.xml
setup.py

index 226617dfe2228e12ada06bcb24465b79ba308902..e6393313d274732efae98f16c1ba269fd91bf8f3 100644 (file)
@@ -44,6 +44,7 @@ import string
 import random
 import shout
 import urllib
+import mimetypes
 from threading import Thread
 from __init__ import *
 
@@ -61,6 +62,7 @@ class Station(Thread):
         self.counter = 0
         self.command = 'cat '
         self.delay = 0
+        self.start_time = time.time()
 
        # Media
         self.media_dir = self.station['media']['dir']
@@ -148,6 +150,13 @@ class Station(Thread):
             self.twitter_key = self.station['twitter']['key']
             self.twitter_secret = self.station['twitter']['secret']
             self.twitter_tags = self.station['twitter']['tags'].split(' ')
+            try:
+                self.twitter_messages = self.station['twitter']['message']
+                if isinstance(self.twitter_messages,  dict):
+                    self.twitter_messages = list(self.twitter_messages)
+            except:
+                pass
+                    
             if self.twitter_mode == 1:
                 self.twitter_callback('/twitter', [1])
 
@@ -347,9 +356,9 @@ class Station(Thread):
         media_objs = []
         for media in media_list:
             file_name, file_title, file_ext = get_file_info(media)
-            if file_ext.lower() == 'mp3':
+            if file_ext.lower() == 'mp3' and mimetypes.guess_type(media)[0] == 'audio/mpeg':
                 media_objs.append(Mp3(media))
-            elif file_ext.lower() == 'ogg':
+            elif file_ext.lower() == 'ogg' and mimetypes.guess_type(media)[0] == 'audio/ogg':
                 media_objs.append(Ogg(media))
         return media_objs
 
index 4fb995c6f42ef93e077665b54355c749cbb1f871..80d62afca47ed7033fa24962f4d715d1864e95fb 100644 (file)
             <key>your access token key</key>
             <secret>your access token secret key</secret>
             <tags>bla bla</tags>
+            <message>
+              <text>hello world !</text>
+              <period>30</period>
+            </message>
         </twitter>
         <jingles>
             <mode>0</mode>
index dc0c993dc769d0da1e483f6db0667759a6e5625d..649ac5f2c41bdf96e7b5d91d0abd19aa567bca78 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -4,10 +4,14 @@
 '''The setup and build script for the python-twitter library.'''
 
 import os
+from distutils.core import setup
 from deefuzzer import __version__
 
 __author__ = 'yomguy@parisson.com'
 
+with open('README.rst') as file:
+    long_description = file.read()
+    
 # The base package metadata to be used by both distutils and setuptools
 METADATA = dict(
   name = "DeeFuzzer",
@@ -24,9 +28,9 @@ METADATA = dict(
   include_package_data = True,
   scripts=['scripts/deefuzzer'], 
   classifiers = ['Programming Language :: Python', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Multimedia :: Sound/Audio', 'Topic :: Multimedia :: Sound/Audio :: Players',],
+  long_description=long_description, 
 )
 
-
 def Main():
   # Use setuptools if available, otherwise fallback and use distutils
   try:
@@ -35,7 +39,6 @@ def Main():
   except ImportError:
     import distutils.core
     distutils.core.setup(**METADATA)
-
-
+    
 if __name__ == '__main__':
     Main()