mirror of
https://github.com/beetbox/beets.git
synced 2026-01-02 14:03:12 +01:00
Merge pull request #2998 from shuaiscott/master
Adding gmusic ability to upload on import
This commit is contained in:
commit
2d2428fa05
3 changed files with 28 additions and 1 deletions
|
|
@ -38,6 +38,12 @@ class Gmusic(BeetsPlugin):
|
|||
else:
|
||||
self.m.perform_oauth()
|
||||
|
||||
self.config.add({
|
||||
u'auto': False,
|
||||
})
|
||||
if self.config['auto']:
|
||||
self.import_stages = [self.autoupload]
|
||||
|
||||
def commands(self):
|
||||
gupload = Subcommand('gmusic-upload',
|
||||
help=u'upload your tracks to Google Play Music')
|
||||
|
|
@ -57,11 +63,22 @@ class Gmusic(BeetsPlugin):
|
|||
|
||||
def upload(self, lib, opts, args):
|
||||
items = lib.items(ui.decargs(args))
|
||||
files = [x.path.decode('utf-8') for x in items]
|
||||
files = self.getpaths(items)
|
||||
ui.print_(u'Uploading your files...')
|
||||
self.m.upload(filepaths=files)
|
||||
ui.print_(u'Your files were successfully added to library')
|
||||
|
||||
def autoupload(self, session, task):
|
||||
items = task.imported_items()
|
||||
files = self.getpaths(items)
|
||||
self._log.info(u'Uploading files to Google Play Music...', files)
|
||||
self.m.upload(filepaths=files)
|
||||
self._log.info(u'Your files were successfully added to your '
|
||||
+ 'Google Play Music library')
|
||||
|
||||
def getpaths(self, items):
|
||||
return [x.path for x in items]
|
||||
|
||||
def search(self, lib, opts, args):
|
||||
password = config['gmusic']['password']
|
||||
email = config['gmusic']['email']
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ New features:
|
|||
:bug:`2944`
|
||||
* Added whitespace padding to missing tracks dialog to improve readability.
|
||||
:user:`jams2`
|
||||
* Automatically upload to Google Play Music library on track import.
|
||||
:user:`shuaiscott`
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ Then, you can enable the ``gmusic`` plugin in your configuration (see
|
|||
Usage
|
||||
-----
|
||||
|
||||
To automatically upload all tracks to Google Play Music, add the ``auto: yes``
|
||||
parameter to your configuration file like the example below::
|
||||
|
||||
gmusic:
|
||||
auto: yes
|
||||
email: user@example.com
|
||||
password: seekrit
|
||||
|
||||
To upload tracks to Google Play Music, use the ``gmusic-upload`` command::
|
||||
|
||||
beet gmusic-upload [QUERY]
|
||||
|
|
|
|||
Loading…
Reference in a new issue