Skip to content

Commit

Permalink
Rename oauth_filepath to oauth_file, update gmusic doc
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarkus committed Aug 15, 2018
1 parent 971b071 commit e824132
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions beetsplug/gmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self):
u'uploader_id': '',
u'uploader_name': '',
u'device_id': '',
u'oauth_filepath': '',
u'oauth_file': gmusicapi.clients.OAUTH_FILEPATH,
})
if self.config['auto']:
self.import_stages = [self.autoupload]
Expand All @@ -62,16 +62,15 @@ def authenticate(self):
return
# Checks for OAuth2 credentials,
# if they don't exist - performs authorization
oauth_filepath = (self.config['oauth_filepath'].as_str()
or gmusicapi.clients.OAUTH_FILEPATH)
if os.path.isfile(oauth_filepath):
oauth_file = self.config['oauth_file'].as_str()
if os.path.isfile(oauth_file):
uploader_id = self.config['uploader_id']
uploader_name = self.config['uploader_name']
self.m.login(oauth_credentials=oauth_filepath,
self.m.login(oauth_credentials=oauth_file,
uploader_id=uploader_id.as_str().upper() or None,
uploader_name=uploader_name.as_str() or None)
else:
self.m.perform_oauth(oauth_filepath)
self.m.perform_oauth(oauth_file)

def upload(self, lib, opts, args):
items = lib.items(ui.decargs(args))
Expand Down
6 changes: 3 additions & 3 deletions docs/plugins/gmusic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Configuration is required before use. Below is an example configuration::
auto: yes
uploader_id: 00:11:22:33:AA:BB
device_id: 00112233AABB
oauth_filepath: ~/.config/beets/oauth.cred
oauth_file: ~/.config/beets/oauth.cred


To upload tracks to Google Play Music, use the ``gmusic-upload`` command::
Expand Down Expand Up @@ -79,8 +79,8 @@ The available options are:
This option only needs to be set if you receive an `InvalidDeviceId`
exception. Below the exception will be a list of valid device IDs.
Default: none.
- **oauth_filepath**: Filepath for oauth credentials file.
Default: none.
- **oauth_file**: Filepath for oauth credentials file.
Default: `{user_data_dir} <https://pypi.org/project/appdirs/>`__/gmusicapi/oauth.cred

Refer to the `Google Play Music Help
<https://support.google.com/googleplaymusic/answer/3139562?hl=en>`__
Expand Down

0 comments on commit e824132

Please sign in to comment.