Skip to content

Commit

Permalink
Merge branch 'release/next' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yomguy committed Dec 31, 2019
2 parents eebb709 + 011e380 commit 3dee15b
Show file tree
Hide file tree
Showing 36 changed files with 315 additions and 451 deletions.
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
language: python
python:
- "2.7"

matrix:
include:
- python: 3.7
os: linux
compiler: gcc

virtualenv:
system_site_packages: true

# command to prepare the system to install prerequisites or dependencies
before_install:
- sudo apt-get install -qq python-setuptools
- sudo apt-get install -qq python-pip python-dev libshout3-dev python-liblo python-mutagen python-pycurl liblo-dev libshout3-dev librtmp-dev python-yaml libcurl4-openssl-dev python-mutagen
- sudo apt-get install -qq python-pip python-dev libshout3-dev python-liblo python-mutagen python-pycurl liblo-dev libshout3-dev librtmp-dev python-yaml libcurl4-openssl-dev python-mutagen libmariadbclient-dev

# command to run tests
script:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ an install inside Gygwin should work well.

To install it, say on Debian, do::

sudo apt-get install python-pip python-dev python-liblo \
sudo apt-get install python3-pip python3-dev cython3 python-liblo \
python-mutagen python-pycurl python-yaml \
libshout3-dev librtmp-dev liblo-dev \
libcurl4-openssl-dev libmariadbclient-dev
Expand Down
8 changes: 4 additions & 4 deletions deefuzzer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from core import *
from station import *
from tools import *
from .core import *
from .station import *
from .tools import *

__version__ = '0.7.4'
__version__ = '0.8.0'
71 changes: 30 additions & 41 deletions deefuzzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,30 @@

# <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>
# This file is part of deefuzzer

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.



import os
import shout
import Queue
import queue
import datetime
import mimetypes
import hashlib
import platform
from threading import Thread
from deefuzzer.station import *
from deefuzzer.tools import *
Expand All @@ -58,7 +45,7 @@ class DeeFuzzer(Thread):
station_settings = []
station_instances = {}
watch_folder = {}
log_queue = Queue.Queue()
log_queue = queue.Queue()
main_loop = False
ignore_errors = False
max_retry = 0
Expand All @@ -67,9 +54,11 @@ def __init__(self, conf_file):
Thread.__init__(self)
self.conf_file = conf_file
self.conf = get_conf_dict(self.conf_file)

if 'deefuzzer' not in self.conf:
return

# print(self.conf)

if 'deefuzzer' not in self.conf :
raise('This is not a standard deefuzzer config file')

# Get the log setting first (if possible)
log_file = str(self.conf['deefuzzer'].pop('log', ''))
Expand All @@ -78,9 +67,8 @@ def __init__(self, conf_file):
os.makedirs(self.log_dir)
self.logger = QueueLogger(log_file, self.log_queue)
self.logger.start()
#print(self.conf)

for key in self.conf['deefuzzer'].keys():
for key in list(self.conf['deefuzzer'].keys()):
if key == 'm3u':
self.m3u = str(self.conf['deefuzzer'][key])

Expand Down Expand Up @@ -113,6 +101,7 @@ def __init__(self, conf_file):

# Set the deefuzzer logger
self._info('Starting DeeFuzzer')
self._info('Using Python version %s' % platform.python_version())
self._info('Using libshout version %s' % shout.version())
self._info('Number of stations : ' + str(len(self.station_settings)))

Expand Down Expand Up @@ -202,7 +191,7 @@ def create_station(self, folder, options):
return
self._info('Creating station for folder ' + folder)
d = dict(path=folder, name=name)
for i in options.keys():
for i in list(options.keys()):
if 'folder' not in i:
s[i] = replace_all(options[i], d)
if 'media' not in s:
Expand Down Expand Up @@ -259,7 +248,7 @@ def add_station(self, this_station):
return

def run(self):
q = Queue.Queue(1)
q = queue.Queue(1)
ns = 0
p = Producer(q)
p.start()
Expand Down Expand Up @@ -317,12 +306,12 @@ def run(self):
if 'short_name' in self.station_settings[i]['infos']:
name = self.station_settings[i]['infos']['short_name']
y = 1
while name in self.station_instances.keys():
while name in list(self.station_instances.keys()):
y += 1
name = self.station_settings[i]['infos']['short_name'] + " " + str(y)

self.station_settings[i]['station_name'] = name
namehash = hashlib.md5(name).hexdigest()
namehash = hashlib.md5(str(name).encode('utf-8')).hexdigest()
self.station_settings[i]['station_statusfile'] = os.sep.join([self.log_dir, namehash])

new_station = Station(self.station_settings[i], q, self.log_queue, self.m3u)
Expand Down
55 changes: 20 additions & 35 deletions deefuzzer/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,23 @@

# <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 *
# This file is part of deefuzzer

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


from .relay import *
import time


Expand Down Expand Up @@ -80,7 +65,7 @@ def file_read_fast(self):
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')
m = open(self.media, 'rb')
while True:
self.main_chunk = m.read(self.main_buffer_size)
if not self.main_chunk:
Expand Down Expand Up @@ -122,7 +107,7 @@ class URLReader:

def __init__(self, relay):
self.__relayparam = relay
self.relay = urllib.urlopen(self.__relayparam)
self.relay = urllib.request.urlopen(self.__relayparam)
self.rec_mode = 0

def set_recorder(self, recorder, mode=1):
Expand All @@ -137,7 +122,7 @@ def read_callback(self, size):
except:
while True:
try:
self.relay = urllib.urlopen(self.__relayparam)
self.relay = urllib.request.urlopen(self.__relayparam)
chunk = self.relay.read(size)
break
except:
Expand Down
46 changes: 16 additions & 30 deletions deefuzzer/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,22 @@

# <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>
# This file is part of deefuzzer

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.



import os

Expand Down
45 changes: 15 additions & 30 deletions deefuzzer/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,25 @@

# <yomguy@parisson.com>

# This software is a computer program whose purpose is to stream audio
# and video data through icecast2 servers.
# This file is part of deefuzzer

# 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".
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# 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.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# 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
import queue
import urllib.request, urllib.parse, urllib.error


class Relay(Thread):
Expand All @@ -47,15 +32,15 @@ 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)
self.queue = queue.Queue(self.queue_size)
self.stream = None

def set_url(self, url):
self.url = url

def open(self):
try:
self.stream = urllib.urlopen(self.url)
self.stream = urllib.request.urlopen(self.url)
self.isopen = True
except:
self.isopen = False
Expand Down
Loading

0 comments on commit 3dee15b

Please sign in to comment.