Adding autoupload method to upload on import
@@ -38,6 +38,9 @@ class Gmusic(BeetsPlugin):
else:
self.m.perform_oauth()
+ if self.config['auto'].get(bool):
+ self.import_stages = [self.autoupload]
+
def commands(self):
gupload = Subcommand('gmusic-upload',
help=u'upload your tracks to Google Play Music')
@@ -62,6 +65,13 @@ class Gmusic(BeetsPlugin):
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']
email = config['gmusic']['email']
