gmusic: Fix compatibility with gmusicapi>=12.0.0

Fixes #3270.
This commit is contained in:
Adrian Sampson 2019-05-18 16:32:56 -04:00
parent d6dc1b7c4e
commit d77a13eb34
2 changed files with 11 additions and 1 deletions

View file

@ -31,12 +31,19 @@ class Gmusic(BeetsPlugin):
def __init__(self): def __init__(self):
super(Gmusic, self).__init__() super(Gmusic, self).__init__()
self.m = Musicmanager() self.m = Musicmanager()
# OAUTH_FILEPATH was moved in gmusicapi 12.0.0.
if hasattr(Musicmanager, 'OAUTH_FILEPATH'):
oauth_file = Musicmanager.OAUTH_FILEPATH
else:
oauth_file = gmusicapi.clients.OAUTH_FILEPATH
self.config.add({ self.config.add({
u'auto': False, u'auto': False,
u'uploader_id': '', u'uploader_id': '',
u'uploader_name': '', u'uploader_name': '',
u'device_id': '', u'device_id': '',
u'oauth_file': gmusicapi.clients.OAUTH_FILEPATH, u'oauth_file': oauth_file,
}) })
if self.config['auto']: if self.config['auto']:
self.import_stages = [self.autoupload] self.import_stages = [self.autoupload]

View file

@ -12,6 +12,9 @@ Fixes:
* :doc:`/plugins/gmusic`: The ``oauth_file`` config option now supports more * :doc:`/plugins/gmusic`: The ``oauth_file`` config option now supports more
flexible path values, including ``~`` for the home directory. flexible path values, including ``~`` for the home directory.
:bug:`3270` :bug:`3270`
* :doc:`/plugins/gmusic`: Fix a crash when using version 12.0.0 or later of
the ``gmusicapi`` module.
:bug:`3270`
1.4.8 (May 16, 2019) 1.4.8 (May 16, 2019)