From bc536d93fd2a3ae9aa0c339c03be512a2b929a1f Mon Sep 17 00:00:00 2001 From: j Date: Thu, 18 Jan 2018 21:32:14 +0100 Subject: [PATCH] settings --- recommendation_engine.py | 8 ++++---- server.py | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) mode change 100644 => 100755 server.py diff --git a/recommendation_engine.py b/recommendation_engine.py index 70f616e..7b68dcf 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -13,12 +13,12 @@ from utils import run_async class Engine: - def __init__(self, path): + def __init__(self, path, **kwargs): self.path = path self.pandora = Pandora( - url='http://pandora.dmp/api/', - username='dd.re', - password='dd.re' + url=kwargs.get('pandora', 'http://pandora.dmp/api/'), + username=kwargs.get('username', 'dd.re'), + password=kwargs.get('password', 'dd.re') ) filename = os.path.join(self.path, 'playlists.json') if os.path.exists(filename): diff --git a/server.py b/server.py old mode 100644 new mode 100755 index 02f4276..8559ffd --- a/server.py +++ b/server.py @@ -76,9 +76,14 @@ def main(prefix='json/'): settings = { 'debug': False, '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 = [ (r'/', RPCHandler, dict(engine=engine)), ]