reformating subsonicupdate.py

Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
Vincent Ducamps 2021-01-11 22:30:14 +01:00 committed by vincent
parent b37c55bc0b
commit 03a665861d
2 changed files with 6 additions and 8 deletions

View file

@ -34,7 +34,7 @@ from beets import config
from beets.plugins import BeetsPlugin
__author__ = 'https://github.com/maffo999'
authtokenversion = '1.12'
AUTH_TOKEN_VERSION = '1.12'
class SubsonicUpdate(BeetsPlugin):
@ -47,14 +47,12 @@ class SubsonicUpdate(BeetsPlugin):
'url': 'http://localhost:4040',
})
self.version = self.__get_version()
if self.version > authtokenversion:
self._log.info(
u'use token authent method')
if self.version > AUTH_TOKEN_VERSION:
self.auth = "token"
else:
self.auth = "password"
self._log.info(
u'use password authent method')
self._log.info(
u"using '{}' authentication method".format(self.auth))
config['subsonic']['pass'].redact = True
self.register_listener('import', self.start_scan)
@ -77,7 +75,7 @@ class SubsonicUpdate(BeetsPlugin):
@staticmethod
def __format_url(endpoint):
"""Get the Subsonic URL to trigger a endpoint put in paramater.
"""Get the Subsonic URL to trigger the given endpoint.
Uses either the url config option or the deprecated host, port,
and context_path config options together.

View file

@ -49,7 +49,7 @@ class SubsonicPluginTest(_common.TestCase, TestHelper):
PING_BODY = '''
{
"subsonic-response": {
"status": "failled",
"status": "failed",
"version": "1.15.0"
}
}