From 7ac629a675a39a9440c503ffd79d53f9e5ab5951 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Fri, 5 Apr 2013 23:39:22 +0200 Subject: [PATCH] config: Create global proxy config section. --- mopidy/backends/spotify/__init__.py | 8 -------- mopidy/backends/spotify/session_manager.py | 6 +++--- mopidy/config.py | 9 +++++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mopidy/backends/spotify/__init__.py b/mopidy/backends/spotify/__init__.py index b03849eb..8ea0ca11 100644 --- a/mopidy/backends/spotify/__init__.py +++ b/mopidy/backends/spotify/__init__.py @@ -26,11 +26,6 @@ timeout = 10 # Path to the Spotify data cache. Cannot be shared with other Spotify apps cache_path = $XDG_CACHE_DIR/mopidy/spotify - -# Connect to Spotify through a proxy -proxy_hostname = -proxy_username = -proxy_password = """ __doc__ = """A backend for playing music from Spotify @@ -81,9 +76,6 @@ class Extension(ext.Extension): schema['bitrate'] = config.Integer(choices=(96, 160, 320)) schema['timeout'] = config.Integer(minimum=0) schema['cache_path'] = config.String() - schema['proxy_hostname'] = config.Hostname(optional=True) - schema['proxy_username'] = config.String(optional=True) - schema['proxy_password'] = config.String(optional=True, secret=True) return schema def validate_environment(self): diff --git a/mopidy/backends/spotify/session_manager.py b/mopidy/backends/spotify/session_manager.py index c27d8215..22ad4632 100644 --- a/mopidy/backends/spotify/session_manager.py +++ b/mopidy/backends/spotify/session_manager.py @@ -35,9 +35,9 @@ class SpotifySessionManager(process.BaseThread, PyspotifySessionManager): PyspotifySessionManager.__init__( self, config['spotify']['username'], config['spotify']['password'], - proxy=config['spotify']['proxy_hostname'], - proxy_username=config['spotify']['proxy_username'], - proxy_password=config['spotify']['proxy_password']) + proxy=config['proxy']['hostname'], + proxy_username=config['proxy']['username'], + proxy_password=config['proxy']['password']) process.BaseThread.__init__(self) self.name = 'SpotifyThread' diff --git a/mopidy/config.py b/mopidy/config.py index 85feffcc..8c55dd9d 100644 --- a/mopidy/config.py +++ b/mopidy/config.py @@ -16,6 +16,11 @@ pykka = info mixer = autoaudiomixer mixer_track = output = autoaudiosink + +[proxy] +hostname = +username = +password = """ config_schemas = {} # TODO: use ordered dict? @@ -31,6 +36,10 @@ config_schemas['audio']['mixer'] = config.String() config_schemas['audio']['mixer_track'] = config.String(optional=True) config_schemas['audio']['output'] = config.String() +config_schemas['proxy']['hostname'] = config.Hostname(optional=True) +config_schemas['proxy']['username'] = config.String(optional=True) +config_schemas['proxy']['password'] = config.String(optional=True, secret=True) + # NOTE: if multiple outputs ever comes something like LogLevelConfigSchema #config_schemas['audio.outputs'] = config.AudioOutputConfigSchema()