config: Create global proxy config section.

This commit is contained in:
Thomas Adamcik 2013-04-05 23:39:22 +02:00
parent c9115aa480
commit 7ac629a675
3 changed files with 12 additions and 11 deletions

View File

@ -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):

View File

@ -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'

View File

@ -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()