Merge branch 'master' of https://www.github.com/Prior99/mopidy-subidy into writable_playlists

This commit is contained in:
hhm 2017-06-04 22:45:01 -04:00
commit a7eef84b2a
5 changed files with 11 additions and 6 deletions

View file

@ -12,7 +12,8 @@ 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)
legacy_auth=(optional - setting to yes may solve some connection errors)
api_version=(optional - specify which API version to use. Subsonic 6.2 uses 1.14.0)
```
## State of this plugin

View file

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

View file

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

View file

@ -4,3 +4,4 @@ url =
username =
password =
legacy_auth = no
api_version = 1.14.0

View file

@ -37,7 +37,7 @@ def diritem_sort_key(item):
return (isdir, key)
class SubsonicApi():
def __init__(self, url, username, password, legacy_auth):
def __init__(self, url, username, password, legacy_auth, api_version):
parsed = urlparse(url)
self.port = parsed.port if parsed.port else \
443 if parsed.scheme == 'https' else 80
@ -48,15 +48,16 @@ class SubsonicApi():
password,
self.port,
parsed.path + '/rest',
legacyAuth=legacy_auth)
legacyAuth=legacy_auth,
apiVersion=api_version)
self.url = url + '/rest'
self.username = username
self.password = password
logger.info('Connecting to subsonic server on url %s as user %s' % (url, username))
logger.info('Connecting to subsonic server on url %s as user %s, API version %s' % (url, username, api_version))
try:
self.connection.ping()
except Exception as e:
logger.error('Unabled to reach subsonic server: %s' % e)
logger.error('Unable to reach subsonic server: %s' % e)
exit()
def get_subsonic_uri(self, view_name, params, censor=False):