from deefuzzer.station import *
from deefuzzer.tools import *
+
class DeeFuzzer(Thread):
"""a DeeFuzzer diffuser"""
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2006-2011 Guillaume Pellerin
+
+# <yomguy@parisson.com>
+
+# This software is a computer program whose purpose is to stream audio
+# and video data through icecast2 servers.
+
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+from relay import *
+
+
+class Player:
+ """A file streaming iterator"""
+
+ def __init__(self, stream_type='icecast'):
+ if stream_type == 'icecast':
+ self.main_buffer_size = 0x100000
+ self.relay_queue_size = 0x100000
+ self.sub_buffer_size = 0x10000
+ elif stream_type == 'stream-m':
+ self.main_buffer_size = 0x100000
+ self.relay_queue_size = 0x100000
+ self.sub_buffer_size = 0x10000
+
+ def set_media(self, media):
+ self.media = media
+
+ def start_relay(self, url):
+ self.url = url
+ self.relay = Relay(self.sub_buffer_size, self.relay_queue_size)
+ self.relay.set_url(self.url)
+ self.relay.open()
+ self.relay.start()
+ self.queue = self.relay.queue
+
+ def stop_relay(self):
+ self.relay.close()
+
+ def file_read_fast(self):
+ """Read media and stream data through a generator."""
+ m = open(self.media, 'r')
+ while True:
+ __main_chunk = m.read(self.sub_buffer_size)
+ if not __main_chunk:
+ break
+ yield __main_chunk
+ m.close()
+
+ def file_read_slow(self):
+ """Read a bigger part of the media and stream the little parts
+ of the data through a generator"""
+ m = open(self.media, 'r')
+ while True:
+ self.main_chunk = m.read(self.main_buffer_size)
+ if not self.main_chunk:
+ break
+ i = 0
+ while True:
+ start = i * self.sub_buffer_size
+ end = self.sub_buffer_size + (i * self.sub_buffer_size)
+ self.sub_chunk = self.main_chunk[start:end]
+ if not self.sub_chunk:
+ break
+ yield self.sub_chunk
+ i += 1
+ self.main_chunk = 0
+ self.sub_chunk = 0
+ m.close()
+
+ def relay_read(self):
+ """Read a distant media through its URL"""
+ while True:
+ self.sub_chunk = self.queue.get(self.sub_buffer_size)
+ if not self.sub_chunk:
+ break
+ yield self.sub_chunk
+ self.queue.task_done()
+ self.sub_chunk = 0
+
+
+class FileReader:
+
+ def __init__(self, fp):
+ self.fp = open(fp, 'r')
+
+ def read_callback(self, size):
+ return self.fp.read(size)
+
+
+class URLReader:
+
+ def __init__(self, relay):
+ self.relay = urllib.urlopen(relay)
+ self.rec_mode = 0
+
+ def set_recorder(self, recorder, mode=1):
+ self.rec_mode = mode
+ self.recorder = recorder
+
+ def read_callback(self, size):
+ try:
+ chunk = self.relay.read(size)
+ except:
+ while True:
+ try:
+ self.relay = urllib.urlopen(relay)
+ chunk = self.relay.read(size)
+ break
+ except:
+ time.sleep(0.5)
+ continue
+
+ if self.rec_mode == 1 and chunk:
+ self.recorder.write(chunk)
+ return chunk
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2006-2009 Guillaume Pellerin
+
+# <yomguy@parisson.com>
+
+# This software is a computer program whose purpose is to stream audio
+# and video data through icecast2 servers.
+
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+import os
+
+
+class Recorder:
+ """A file streaming iterator"""
+
+ def __init__(self, path):
+ self.path = path
+ self.recording = True
+
+ def open(self, filename):
+ self.filename = filename
+ self.media = open(self.path + os.sep + self.filename, 'w')
+
+ def write(self, chunk):
+ try:
+ if self.recording:
+ self.media.write(chunk)
+ self.media.flush()
+ except:
+ pass
+
+ def close(self):
+ self.media.close()
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2006-2011 Guillaume Pellerin
+
+# <yomguy@parisson.com>
+
+# This software is a computer program whose purpose is to stream audio
+# and video data through icecast2 servers.
+
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+from threading import Thread
+import Queue
+import urllib
+
+
+class Relay(Thread):
+
+ def __init__(self, sub_buffer_size, queue_size):
+ Thread.__init__(self)
+ self.sub_buffer_size = sub_buffer_size
+ self.queue_size = queue_size
+ self.queue = Queue.Queue(self.queue_size)
+
+ def set_url(self, url):
+ self.url = url
+
+ def open(self):
+ try:
+ self.stream = urllib.urlopen(self.url)
+ self.isopen = True
+ except:
+ self.isopen = False
+
+ def close(self):
+ if self.stream:
+ self.isopen = False
+
+ def run(self):
+ while True:
+ if self.isopen:
+ self.chunk = self.stream.read(self.sub_buffer_size)
+ self.queue.put_nowait(self.chunk)
+# print self.queue.qsize()
+ else:
+ self.stream.close()
+ break
+
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/jingles", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/jingles", 0)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/player", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- sys.exit(err)
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/media/next", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/player", 0)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/record", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/record", 0)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/media/relay", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/media/relay", 0)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/twitter", 1)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import liblo, sys
-
-# send all messages to port 1234 on the local machine
-try:
- target = liblo.Address(1234)
-except liblo.AddressError, err:
- print str(err)
- sys.exit()
-
-# send message "/foo/message1" with int, float and string arguments
-liblo.send(target, "/twitter", 0)
import shout
import urllib
import mimetypes
+
from threading import Thread
+from player import *
+from recorder import *
+from relay import *
+from streamer import *
from tools import *
-
class Station(Thread):
"""a DeeFuzzer shouting station thread"""
self.ogg_quality = self.station['media']['ogg_quality']
self.samplerate = self.station['media']['samplerate']
self.voices = self.station['media']['voices']
+ if 'm3u' in self.station['media'].keys():
+ self.m3u_playlist_file = self.station['media']['m3u']
# Server
if 'mountpoint' in self.station['server'].keys():
def get_playlist(self):
file_list = []
- for root, dirs, files in os.walk(self.media_dir):
- for file in files:
- s = file.split('.')
- ext = s[len(s)-1]
- if ext.lower() == self.channel.format and not os.sep+'.' in file:
- file_list.append(root + os.sep + file)
- file_list.sort()
+ if not self.m3u_playlist_file:
+ for root, dirs, files in os.walk(self.media_dir):
+ for file in files:
+ s = file.split('.')
+ ext = s[len(s)-1]
+ if ext.lower() == self.channel.format and not os.sep+'.' in file:
+ file_list.append(root + os.sep + file)
+ file_list.sort()
+ else:
+ f = open(self.m3u_playlist_file, 'r')
+ for path in f.readlines():
+ if '#' != path[0]:
+ file_list.append(path[:-1])
return file_list
def get_jingles(self):
def get_next_media(self):
# Init playlist
- if self.lp != 0:
+ if self.lp:
playlist = self.playlist
new_playlist = self.get_playlist()
lp_new = len(new_playlist)
- if lp_new != self.lp or self.counter == 0:
+ if lp_new != self.lp or not self.counter:
self.id = 0
self.lp = lp_new
new_tracks = new_playlist_set - playlist_set
self.new_tracks = list(new_tracks.copy())
- if len(new_tracks) != 0:
+ if len(new_tracks):
new_tracks_objs = self.media_to_objs(self.new_tracks)
for media_obj in new_tracks_objs:
title = media_obj.metadata['title']
self.update_twitter(message)
# Shake it, Fuzz it !
- if self.shuffle_mode == 1:
+ if self.shuffle_mode:
random.shuffle(playlist)
# Play new tracks first
self.update_rss(self.media_to_objs(self.playlist),
self.rss_playlist_file, '(playlist)')
- if self.jingles_mode == 1 and (self.counter % 2) == 0 and not self.jingles_length == 0:
+ if self.jingles_mode and not (self.counter % 2) and self.jingles_length:
media = self.jingles_list[self.jingle_id]
self.jingle_id = (self.jingle_id + 1) % self.jingles_length
else:
self.q.task_done()
pass
+
def run(self):
self.q.get(1)
self.ping_server()
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2006-2011 Guillaume Pellerin
+
+# <yomguy@parisson.com>
+
+# This software is a computer program whose purpose is to stream audio
+# and video data through icecast2 servers.
+
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+from threading import Thread
+
+class HTTPStreamer(Thread):
+
+ protocol = 'http'
+ host = str
+ port = str
+ mount = str
+ user = str
+ password = str
+ public = str
+ audio_info = dict
+ name = str
+ genre = str
+ decription = str
+ format = str
+ url = str
+ delay = 0
+
+ def __init__(self):
+ Thread.__init__(self)
+ import pycurl
+ self.curl = pycurl.Curl()
+
+ def set_callback(self, read_callback):
+ self.read_callback = read_callback
+
+ def delay(self):
+ return self.delay
+
+ def open(self):
+ import pycurl
+ self.uri = self.protocol + '://' + self.host + ':' + str(self.port) + \
+ self.mount + '?' + 'password=' + self.password
+ self.curl.setopt(pycurl.URL, self.uri)
+ self.curl.setopt(pycurl.UPLOAD, 1)
+ self.curl.setopt(pycurl.READFUNCTION, self.read_callback)
+
+ def run(self):
+ self.curl.perform()
+
+ def close(self):
+ self.curl.close()
from mp3 import *
from ogg import *
from logger import *
-from player import *
-from recorder import *
from osc import *
from twitt import *
-from relay import *
-from tools import *
-from streamer import *
+from utils import *
import logging
+
class Logger:
"""A logging object"""
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2006-2011 Guillaume Pellerin
-
-# <yomguy@parisson.com>
-
-# This software is a computer program whose purpose is to stream audio
-# and video data through icecast2 servers.
-
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-from relay import *
-
-class Player:
- """A file streaming iterator"""
-
- def __init__(self, stream_type='icecast'):
- if stream_type == 'icecast':
- self.main_buffer_size = 0x100000
- self.relay_queue_size = 0x100000
- self.sub_buffer_size = 0x10000
- elif stream_type == 'stream-m':
- self.main_buffer_size = 0x100000
- self.relay_queue_size = 0x100000
- self.sub_buffer_size = 0x10000
-
- def set_media(self, media):
- self.media = media
-
- def start_relay(self, url):
- self.url = url
- self.relay = Relay(self.sub_buffer_size, self.relay_queue_size)
- self.relay.set_url(self.url)
- self.relay.open()
- self.relay.start()
- self.queue = self.relay.queue
-
- def stop_relay(self):
- self.relay.close()
-
- def file_read_fast(self):
- """Read media and stream data through a generator."""
- m = open(self.media, 'r')
- while True:
- __main_chunk = m.read(self.sub_buffer_size)
- if not __main_chunk:
- break
- yield __main_chunk
- m.close()
-
- def file_read_slow(self):
- """Read a bigger part of the media and stream the little parts
- of the data through a generator"""
- m = open(self.media, 'r')
- while True:
- self.main_chunk = m.read(self.main_buffer_size)
- if not self.main_chunk:
- break
- i = 0
- while True:
- start = i * self.sub_buffer_size
- end = self.sub_buffer_size + (i * self.sub_buffer_size)
- self.sub_chunk = self.main_chunk[start:end]
- if not self.sub_chunk:
- break
- yield self.sub_chunk
- i += 1
- self.main_chunk = 0
- self.sub_chunk = 0
- m.close()
-
- def relay_read(self):
- """Read a distant media through its URL"""
- while True:
- self.sub_chunk = self.queue.get(self.sub_buffer_size)
- if not self.sub_chunk:
- break
- yield self.sub_chunk
- self.queue.task_done()
- self.sub_chunk = 0
-
-
-class FileReader:
-
- def __init__(self, fp):
- self.fp = open(fp, 'r')
-
- def read_callback(self, size):
- return self.fp.read(size)
-
-
-class URLReader:
-
- def __init__(self, relay):
- self.relay = urllib.urlopen(relay)
- self.rec_mode = 0
-
- def set_recorder(self, recorder, mode=1):
- self.rec_mode = mode
- self.recorder = recorder
-
- def read_callback(self, size):
- try:
- chunk = self.relay.read(size)
- except:
- while True:
- try:
- self.relay = urllib.urlopen(relay)
- chunk = self.relay.read(size)
- break
- except:
- time.sleep(0.5)
- continue
-
- if self.rec_mode == 1 and chunk:
- self.recorder.write(chunk)
- return chunk
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2006-2009 Guillaume Pellerin
-
-# <yomguy@parisson.com>
-
-# This software is a computer program whose purpose is to stream audio
-# and video data through icecast2 servers.
-
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-import os
-
-class Recorder:
- """A file streaming iterator"""
-
- def __init__(self, path):
- self.path = path
- self.recording = True
-
- def open(self, filename):
- self.filename = filename
- self.media = open(self.path + os.sep + self.filename, 'w')
-
- def write(self, chunk):
- try:
- if self.recording:
- self.media.write(chunk)
- self.media.flush()
- except:
- pass
-
- def close(self):
- self.media.close()
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2006-2011 Guillaume Pellerin
-
-# <yomguy@parisson.com>
-
-# This software is a computer program whose purpose is to stream audio
-# and video data through icecast2 servers.
-
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-from threading import Thread
-import Queue
-import urllib
-
-class Relay(Thread):
-
- def __init__(self, sub_buffer_size, queue_size):
- Thread.__init__(self)
- self.sub_buffer_size = sub_buffer_size
- self.queue_size = queue_size
- self.queue = Queue.Queue(self.queue_size)
-
- def set_url(self, url):
- self.url = url
-
- def open(self):
- try:
- self.stream = urllib.urlopen(self.url)
- self.isopen = True
- except:
- self.isopen = False
-
- def close(self):
- if self.stream:
- self.isopen = False
-
- def run(self):
- while True:
- if self.isopen:
- self.chunk = self.stream.read(self.sub_buffer_size)
- self.queue.put_nowait(self.chunk)
-# print self.queue.qsize()
- else:
- self.stream.close()
- break
-
-
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2006-2011 Guillaume Pellerin
-
-# <yomguy@parisson.com>
-
-# This software is a computer program whose purpose is to stream audio
-# and video data through icecast2 servers.
-
-# This software is governed by the CeCILL license under French law and
-# abiding by the rules of distribution of free software. You can use,
-# modify and/ or redistribute the software under the terms of the CeCILL
-# license as circulated by CEA, CNRS and INRIA at the following URL
-# "http://www.cecill.info".
-
-# As a counterpart to the access to the source code and rights to copy,
-# modify and redistribute granted by the license, users are provided only
-# with a limited warranty and the software's author, the holder of the
-# economic rights, and the successive licensors have only limited
-# liability.
-
-# In this respect, the user's attention is drawn to the risks associated
-# with loading, using, modifying and/or developing or reproducing the
-# software by the user in light of its specific status of free software,
-# that may mean that it is complicated to manipulate, and that also
-# therefore means that it is reserved for developers and experienced
-# professionals having in-depth computer knowledge. Users are therefore
-# encouraged to load and test the software's suitability as regards their
-# requirements in conditions enabling the security of their systems and/or
-# data to be ensured and, more generally, to use and operate it in the
-# same conditions as regards security.
-
-# The fact that you are presently reading this means that you have had
-# knowledge of the CeCILL license and that you accept its terms.
-
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-from threading import Thread
-
-class HTTPStreamer(Thread):
-
- protocol = 'http'
- host = str
- port = str
- mount = str
- user = str
- password = str
- public = str
- audio_info = dict
- name = str
- genre = str
- decription = str
- format = str
- url = str
- delay = 0
-
- def __init__(self):
- Thread.__init__(self)
- import pycurl
- self.curl = pycurl.Curl()
-
- def set_callback(self, read_callback):
- self.read_callback = read_callback
-
- def delay(self):
- return self.delay
-
- def open(self):
- import pycurl
- self.uri = self.protocol + '://' + self.host + ':' + str(self.port) + \
- self.mount + '?' + 'password=' + self.password
- self.curl.setopt(pycurl.URL, self.uri)
- self.curl.setopt(pycurl.UPLOAD, 1)
- self.curl.setopt(pycurl.READFUNCTION, self.read_callback)
-
- def run(self):
- self.curl.perform()
-
- def close(self):
- self.curl.close()
+++ /dev/null
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-#
-# Copyright (c) 2007-2009 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/deefuzz/wiki/DefuzzLicense.
-#
-# Author: Guillaume Pellerin <yomguy@parisson.com>
-
-import os
-import re
-import string
-
-def clean_word(word) :
- """ Return the word without excessive blank spaces, underscores and
- characters causing problem to exporters"""
- word = re.sub("^[^\w]+","",word) #trim the beginning
- word = re.sub("[^\w]+$","",word) #trim the end
- word = re.sub("_+","_",word) #squeeze continuous _ to one _
- word = re.sub("^[^\w]+","",word) #trim the beginning _
- #word = string.replace(word,' ','_')
- #word = string.capitalize(word)
- dict = '&[];"*:,'
- for letter in dict:
- word = string.replace(word,letter,'_')
- return word
-
-def get_file_info(media):
- file_name = media.split(os.sep)[-1]
- file_title = file_name.split('.')[:-1]
- file_title = '.'.join(file_title)
- file_ext = file_name.split('.')[-1]
- return file_name, file_title, file_ext
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2007-2009 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/deefuzz/wiki/DefuzzLicense.
+#
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+import os
+import re
+import string
+
+def clean_word(word) :
+ """ Return the word without excessive blank spaces, underscores and
+ characters causing problem to exporters"""
+ word = re.sub("^[^\w]+","",word) #trim the beginning
+ word = re.sub("[^\w]+$","",word) #trim the end
+ word = re.sub("_+","_",word) #squeeze continuous _ to one _
+ word = re.sub("^[^\w]+","",word) #trim the beginning _
+ #word = string.replace(word,' ','_')
+ #word = string.capitalize(word)
+ dict = '&[];"*:,'
+ for letter in dict:
+ word = string.replace(word,letter,'_')
+ return word
+
+def get_file_info(media):
+ file_name = media.split(os.sep)[-1]
+ file_title = file_name.split('.')[:-1]
+ file_title = '.'.join(file_title)
+ file_ext = file_name.split('.')[-1]
+ return file_name, file_title, file_ext
<samplerate>44100</samplerate>
<voices>2</voices>
<shuffle>1</shuffle>
+ <m3u>/path/to/m3u_file</m3u>
</media>
<rss>
<dir>/path/to/rss/</dir>
--- /dev/null
+deefuzzer:
+ log: /path/to/log/mystation.log
+ m3u: /path/to/m3u/mystation.m3u
+
+ station:
+ control: {mode: 0,
+ port: 16001}
+
+ server: {host: 127.0.0.1,
+ mountpoint: monitor,
+ port: 8000, public: 0,
+ sourcepassword: source2parisson,
+ type: icecast}
+
+ infos: {name: my_station,
+ description: my_station,
+ genre: music,
+ url: 'http://parisson.com'}
+
+ media: {dir: /path/to/mp3/,
+ m3u: /path/to/m3u_file,
+ format: mp3,
+ bitrate: 96,
+ ogg_quality: 4,
+ samplerate: 48000,
+ shuffle: 0,
+ voices: '2'}
+
+ jingles: {dir: /path/to/jingles,
+ mode: 0,
+ shuffle: 1}
+
+ record: {dir: /home/telecaster/archives/mp3,
+ mode: 0}
+
+ relay: {author: Inconnu,
+ mode: 0,
+ url: 'http://127.0.0.1:8000/telecaster_live.mp3'}
+
+ rss: {dir: /var/www/rss,
+ enclosure: 0,
+ media_url: 'http://localhost/rss/'}
+
+
+ twitter: {key: 76728330-OjKgbHtn4II86Ad7pNUGEzfNAkGTW5Wvw38qUmLE,
+ mode: 0, secret: 4egZs1dSM37XVY8zXa016Yueku2fleXF2bx8k25V4,
+ tags: bla bla}
<voices>2</voices>
<!-- If '1', the playlist will be randomized. '0' for aphanumeric order -->
<shuffle>1</shuffle>
+ <!-- You can also give a M3U playlist file -->
+ <m3u>/path/to/m3u_file</m3u>
</media>
<rss>
<!-- A path to the directory containing RSS (XML) files that is 'currently playing'
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/jingles", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/jingles", 0)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/player", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ sys.exit(err)
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/next", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/player", 0)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/record", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/record", 0)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/relay", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/relay", 0)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/twitter", 1)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+ target = liblo.Address(1234)
+except liblo.AddressError, err:
+ print str(err)
+ sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/twitter", 0)