# -*- coding: utf-8 -*-
#
-# Copyright (c) 2007-2007 Guillaume Pellerin <pellerin@parisson.com>
+# Copyright (c) 2007-2009 Guillaume Pellerin <pellerin@parisson.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
#
# Author: Guillaume Pellerin <pellerin@parisson.com>
- depends : python, python-dev, python-xml, python-shout | shout-python, libshout3, libshout3-dev, icecast2
- recommends : python-mutagen
+ depends : python, python-dev, python-xml, python-shout | shout-python, libshout3,
+ libshout3-dev, icecast2 python-mutagen
+
provides : shout-python
python-shout is included in DeeFuzz but needs to be compiled and installed.
# 1. Introduction
# ===============
-DeeFuzz is a light python program that streams media data from file systems to icecast2
-with the metadata. It supports MP3, OGG, SPEEX and THEORA media.
+DeeFuzz Tools are new light and easy tools to stream audio and video over internet. It is dedicated to people who wants to create playlisted webradios or webTVs with rich media contents. It depends on python, icecast2 server, libshout and some other tools.
+
+Here are the main features of the DeeFuzz Tools:
+
+ * MP3 and OGG (audio & video) streaming over internet
+ * Full metadata encapsulation and management
+ * RSS podcast feeding (current tracks and playlists)
+ * M3U playlist feefing
+ * Multi-theading architecture (multiple stations now authorized)
+ * Optional random (shuffled) playlists
+ * VERY light and optimized streaming process !
It is neccessary to provide a config file which sets all needed parameters
-(see example/myfuzz.xml for example).
+(see example/myfuzz.xml for an example).
# 2. Installation
else:
sub_title = '(playlist)'
+ channel_subtitle = self.channel.name + ' ' + sub_title
+
for media in media_list:
- media_link = self.channel.url + self.media_url_dir + media.file_name.decode()
+ media_link = self.channel.url + self.media_url_dir + media.file_name
+ media_link = media_link.decode('utf-8')
media_description = '<table>'
for key in media.metadata.keys():
if media.metadata[key] != '':
media_stats = os.stat(media.media)
media_date = time.localtime(media_stats[8])
media_date = time.strftime("%a, %d %b %Y %H:%M:%S +0000", media_date)
-
+ date_now = str(datetime.datetime.now())
+
title = media.metadata['title']
artist = media.metadata['artist']
if not (title or artist):
song = str(media.file_name)
else:
song = artist + ' : ' + title
-
+
+
if self.rss_enclosure == '1':
rss_item_list.append(PyRSS2Gen.RSSItem(
- title = song.decode(),
+ title = song,
link = media_link,
description = media_description,
enclosure = PyRSS2Gen.Enclosure(media_link, str(media.size), 'audio/mpeg'),
)
else:
rss_item_list.append(PyRSS2Gen.RSSItem(
- title = song.decode(),
+ title = song,
link = media_link,
description = media_description,
guid = PyRSS2Gen.Guid(media_link),
pubDate = media_date,)
)
- rss = PyRSS2Gen.RSS2(title = self.channel.name + ' ' + sub_title,
+ rss = PyRSS2Gen.RSS2(title = channel_subtitle,
link = self.channel.url,
description = self.channel.description,
- lastBuildDate = datetime.datetime.now(),
+ lastBuildDate = date_now,
items = rss_item_list,)
f = open(rss_file, 'w')
- rss.write_xml(f)
+ rss.write_xml(f, 'utf-8')
f.close()
def set_playlist(self):
if not (title or artist):
song = str(self.current_media_obj[0].file_name)
else:
- song = str(artist) + ' : ' + str(title)
+ song = artist + ' : ' + title.decode('utf-8')
- self.channel.set_metadata({'song': song})
+ self.channel.set_metadata({'song': str(song)})
self.update_rss(self.current_media_obj, self.rss_current_file)
self.logger.write('DeeFuzzing this file on %s : id = %s, index = %s, name = %s' \
% (self.short_name, self.id, self.index_list[self.id], self.current_media_obj[0].file_name))
# Could make this the base class; will need to add 'publish'
class WriteXmlMixin:
- def write_xml(self, outfile, encoding = "iso-8859-1"):
+ def write_xml(self, outfile, encoding = "utf-8"):
from xml.sax import saxutils
handler = saxutils.XMLGenerator(outfile, encoding)
handler.startDocument()
self.publish(handler)
handler.endDocument()
- def to_xml(self, encoding = "iso-8859-1"):
+ def to_xml(self, encoding = "utf-8"):
try:
import cStringIO as StringIO
except ImportError: