B"H add py-sonic legacy auth support

This commit is contained in:
hhm 2017-02-09 23:34:30 -05:00
parent dcd8ee2197
commit 7989432894
5 changed files with 8 additions and 4 deletions

View file

@ -12,6 +12,7 @@ enabled=True
url=https://path.to/your/subsonic/server
username=subsonic_username
password=your_secret_password
legacy_auth = (optional; setting to yes may solve some connection errors)
```
## State of this plugin

View file

@ -22,6 +22,7 @@ class SubidyExtension(ext.Extension):
schema['url'] = config.String()
schema['username'] = config.String()
schema['password'] = config.Secret()
schema['legacy_auth'] = config.Boolean(optional=True)
return schema
def setup(self, registry):

View file

@ -9,7 +9,8 @@ class SubidyBackend(pykka.ThreadingActor, backend.Backend):
self.subsonic_api = subsonic_api.SubsonicApi(
url=subidy_config['url'],
username=subidy_config['username'],
password=subidy_config['password'])
password=subidy_config['password'],
legacy_auth=subidy_config['legacy_auth'])
self.library = library.SubidyLibraryProvider(backend=self)
self.playback = playback.SubidyPlaybackProvider(audio=audio, backend=self)
self.playlists = playlists.SubidyPlaylistsProvider(backend=self)

View file

@ -3,4 +3,4 @@ enabled = true
url =
username =
password =
legacy_auth = no

View file

@ -16,7 +16,7 @@ MAX_SEARCH_RESULTS = 100
ref_sort_key = lambda ref: ref.name
class SubsonicApi():
def __init__(self, url, username, password):
def __init__(self, url, username, password, legacy_auth):
parsed = urlparse(url)
self.port = parsed.port if parsed.port else \
443 if parsed.scheme == 'https' else 80
@ -26,7 +26,8 @@ class SubsonicApi():
username,
password,
self.port,
parsed.path + '/rest')
parsed.path + '/rest',
legacyAuth=legacy_auth)
self.url = url + '/rest'
self.username = username
self.password = password