diff --git a/larigira/rpc.py b/larigira/rpc.py index 783ab86..d23b08b 100644 --- a/larigira/rpc.py +++ b/larigira/rpc.py @@ -1,24 +1,17 @@ -import logging import gc +import logging from copy import deepcopy -from greenlet import greenlet -from flask import ( - current_app, - Blueprint, - Flask, - jsonify, - render_template, - request, - abort, - redirect, -) -from flask_bootstrap import Bootstrap +from flask import (Blueprint, Flask, abort, current_app, jsonify, redirect, + render_template, request) from flask.ext.babel import Babel +from flask_bootstrap import Bootstrap from werkzeug.contrib.cache import SimpleCache -from .dbadmin import db +from greenlet import greenlet + from .config import get_conf +from .dbadmin import db rpc = Blueprint("rpc", __name__, url_prefix=get_conf()["ROUTE_PREFIX"] + "/api") viewui = Blueprint( diff --git a/setup.py b/setup.py index b5be872..5d66949 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -import sys import os +import sys from setuptools import setup from setuptools.command.test import test as TestCommand @@ -11,7 +11,7 @@ def read(fname): class PyTest(TestCommand): - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] + user_options = [("pytest-args=", "a", "Arguments to pass to py.test")] def initialize_options(self): TestCommand.initialize_options(self) @@ -25,89 +25,93 @@ class PyTest(TestCommand): def run_tests(self): # import here, cause outside the eggs aren't loaded import pytest + errno = pytest.main(self.pytest_args) sys.exit(errno) -setup(name='larigira', - version='1.3.1', - description='A radio automation based on MPD', - long_description=read('README.rst'), - long_description_content_type='text/x-rst', - author='boyska', - author_email='piuttosto@logorroici.org', - license='AGPL', - packages=['larigira', 'larigira.dbadmin', 'larigira.filters'], - install_requires=[ - 'Babel==2.6.0', - 'Flask-Babel==0.12.2', - 'pyxdg', - 'gevent', - 'flask-bootstrap', - 'python-mpd2', - 'wtforms', - 'Flask-WTF', - 'flask==0.11', - 'pytimeparse', - 'croniter==0.3.29', - 'tinydb' - ], - tests_require=['pytest-timeout==1.0', 'py>=1.4.29', 'pytest==3.0', ], - python_requires='>=3.5', - extras_require={ - 'percentwait': ['mutagen'], - }, - cmdclass={'test': PyTest}, - zip_safe=False, - include_package_data=True, - entry_points={ - 'console_scripts': ['larigira=larigira.larigira:main', - 'larigira-timegen=larigira.timegen:main', - 'larigira-audiogen=larigira.audiogen:main', - 'larigira-dbmanage=larigira.event_manage:main'], - 'larigira.audiogenerators': [ - 'mpd = larigira.audiogen_mpdrandom:generate_by_artist', - 'static = larigira.audiogen_static:generate', - 'http = larigira.audiogen_http:generate', - 'randomdir = larigira.audiogen_randomdir:generate', - 'mostrecent = larigira.audiogen_mostrecent:generate', - 'script = larigira.audiogen_script:generate', - ], - 'larigira.timegenerators': [ - 'frequency = larigira.timegen_every:FrequencyAlarm', - 'single = larigira.timegen_every:SingleAlarm', - 'cron = larigira.timegen_cron:CronAlarm', - ], - 'larigira.timeform_create': [ - 'single = larigira.timeform_base:SingleAlarmForm', - 'frequency = larigira.timeform_base:FrequencyAlarmForm', - 'cron = larigira.timeform_cron:CronAlarmForm', - ], - 'larigira.timeform_receive': [ - 'single = larigira.timeform_base:singlealarm_receive', - 'frequency = larigira.timeform_base:frequencyalarm_receive', - 'cron = larigira.timeform_cron:cronalarm_receive', - ], - 'larigira.audioform_create': [ - 'static = larigira.audioform_static:StaticAudioForm', - 'http = larigira.audioform_http:AudioForm', - 'script = larigira.audioform_script:ScriptAudioForm', - 'randomdir = larigira.audioform_randomdir:Form', - 'mostrecent = larigira.audioform_mostrecent:AudioForm', - ], - 'larigira.audioform_receive': [ - 'static = larigira.audioform_static:staticaudio_receive', - 'http = larigira.audioform_http:audio_receive', - 'script = larigira.audioform_script:scriptaudio_receive', - 'randomdir = larigira.audioform_randomdir:receive', - 'mostrecent = larigira.audioform_mostrecent:audio_receive', - ], - 'larigira.eventfilter': [ - 'maxwait = larigira.filters:maxwait', - 'percentwait = larigira.filters:percentwait', - ], - }, - classifiers=[ - "License :: OSI Approved :: GNU Affero General Public License v3", - "Programming Language :: Python :: 3", - ] - ) + +setup( + name="larigira", + version="1.3.1", + description="A radio automation based on MPD", + long_description=read("README.rst"), + long_description_content_type="text/x-rst", + author="boyska", + author_email="piuttosto@logorroici.org", + license="AGPL", + packages=["larigira", "larigira.dbadmin", "larigira.filters"], + install_requires=[ + "Babel==2.6.0", + "Flask-Babel==0.12.2", + "pyxdg", + "gevent", + "flask-bootstrap", + "python-mpd2", + "wtforms", + "Flask-WTF", + "flask==0.11", + "pytimeparse", + "croniter==0.3.29", + "werkzeug==0.14.1", + "tinydb", + ], + tests_require=["pytest-timeout==1.0", "py>=1.4.29", "pytest==3.0"], + python_requires=">=3.5", + extras_require={"percentwait": ["mutagen"]}, + cmdclass={"test": PyTest}, + zip_safe=False, + include_package_data=True, + entry_points={ + "console_scripts": [ + "larigira=larigira.larigira:main", + "larigira-timegen=larigira.timegen:main", + "larigira-audiogen=larigira.audiogen:main", + "larigira-dbmanage=larigira.event_manage:main", + ], + "larigira.audiogenerators": [ + "mpd = larigira.audiogen_mpdrandom:generate_by_artist", + "static = larigira.audiogen_static:generate", + "http = larigira.audiogen_http:generate", + "randomdir = larigira.audiogen_randomdir:generate", + "mostrecent = larigira.audiogen_mostrecent:generate", + "script = larigira.audiogen_script:generate", + ], + "larigira.timegenerators": [ + "frequency = larigira.timegen_every:FrequencyAlarm", + "single = larigira.timegen_every:SingleAlarm", + "cron = larigira.timegen_cron:CronAlarm", + ], + "larigira.timeform_create": [ + "single = larigira.timeform_base:SingleAlarmForm", + "frequency = larigira.timeform_base:FrequencyAlarmForm", + "cron = larigira.timeform_cron:CronAlarmForm", + ], + "larigira.timeform_receive": [ + "single = larigira.timeform_base:singlealarm_receive", + "frequency = larigira.timeform_base:frequencyalarm_receive", + "cron = larigira.timeform_cron:cronalarm_receive", + ], + "larigira.audioform_create": [ + "static = larigira.audioform_static:StaticAudioForm", + "http = larigira.audioform_http:AudioForm", + "script = larigira.audioform_script:ScriptAudioForm", + "randomdir = larigira.audioform_randomdir:Form", + "mostrecent = larigira.audioform_mostrecent:AudioForm", + ], + "larigira.audioform_receive": [ + "static = larigira.audioform_static:staticaudio_receive", + "http = larigira.audioform_http:audio_receive", + "script = larigira.audioform_script:scriptaudio_receive", + "randomdir = larigira.audioform_randomdir:receive", + "mostrecent = larigira.audioform_mostrecent:audio_receive", + ], + "larigira.eventfilter": [ + "maxwait = larigira.filters:maxwait", + "percentwait = larigira.filters:percentwait", + ], + }, + classifiers=[ + "License :: OSI Approved :: GNU Affero General Public License v3", + "Programming Language :: Python :: 3", + ], +)