From: Guillaume Pellerin Date: Fri, 16 Sep 2011 09:25:19 +0000 (+0000) Subject: readd long description, begin messages, check mimetypes before writing the playlist X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c1edb39b3feecd1fbdd4fadc215d30a4497ac4ea;p=deefuzzer.git readd long description, begin messages, check mimetypes before writing the playlist --- diff --git a/deefuzzer/tools/station.py b/deefuzzer/tools/station.py index 226617d..e639331 100644 --- a/deefuzzer/tools/station.py +++ b/deefuzzer/tools/station.py @@ -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 diff --git a/example/deefuzzer.xml b/example/deefuzzer.xml index 4fb995c..80d62af 100644 --- a/example/deefuzzer.xml +++ b/example/deefuzzer.xml @@ -34,6 +34,10 @@ your access token key your access token secret key bla bla + + hello world ! + 30 + 0 diff --git a/setup.py b/setup.py index dc0c993..649ac5f 100644 --- 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()