This commit is contained in:
j 2018-01-18 21:32:14 +01:00
parent 52d87d4265
commit bc536d93fd
2 changed files with 11 additions and 6 deletions

View file

@ -13,12 +13,12 @@ from utils import run_async
class Engine: class Engine:
def __init__(self, path): def __init__(self, path, **kwargs):
self.path = path self.path = path
self.pandora = Pandora( self.pandora = Pandora(
url='http://pandora.dmp/api/', url=kwargs.get('pandora', 'http://pandora.dmp/api/'),
username='dd.re', username=kwargs.get('username', 'dd.re'),
password='dd.re' password=kwargs.get('password', 'dd.re')
) )
filename = os.path.join(self.path, 'playlists.json') filename = os.path.join(self.path, 'playlists.json')
if os.path.exists(filename): if os.path.exists(filename):

9
server.py Normal file → Executable file
View file

@ -76,9 +76,14 @@ def main(prefix='json/'):
settings = { settings = {
'debug': False, 'debug': False,
'port': 8081, 'port': 8081,
'address': '' 'address': '',
'pandora': 'http://pandora.dmp/api/',
'pandora_ws': 'ws://pandora.dmp/api/ws/',
'username': 'dd.re',
'password': 'dd.re'
} }
engine = Engine(prefix) engine = Engine(prefix, **settings)
handlers = [ handlers = [
(r'/', RPCHandler, dict(engine=engine)), (r'/', RPCHandler, dict(engine=engine)),
] ]