mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 10:34:09 +01:00
Adding autoupload method to upload on import
This commit is contained in:
parent
27da1f9423
commit
69b4c68b63
1 changed files with 10 additions and 0 deletions
|
|
@ -37,6 +37,9 @@ class Gmusic(BeetsPlugin):
|
|||
self.m.login()
|
||||
else:
|
||||
self.m.perform_oauth()
|
||||
|
||||
if self.config['auto'].get(bool):
|
||||
self.import_stages = [self.autoupload]
|
||||
|
||||
def commands(self):
|
||||
gupload = Subcommand('gmusic-upload',
|
||||
|
|
@ -61,6 +64,13 @@ class Gmusic(BeetsPlugin):
|
|||
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 = [x.path.decode('utf-8') for x in items]
|
||||
ui.print_(u'Uploading your files...')
|
||||
self.m.upload(filepaths=files)
|
||||
ui.print_(u'Your files were successfully added to library')
|
||||
|
||||
def search(self, lib, opts, args):
|
||||
password = config['gmusic']['password']
|
||||
|
|
|
|||
Loading…
Reference in a new issue