Exemple #1
0
 def get_gdrive_repos(self):
     gdriverepo_paths = GDriveSync.scan_repo_paths([os.path.expanduser(SyncHandler.LOC)])
     gdriverepos = {}
     for repopath in gdriverepo_paths:
         gs = GDriveSync(repopath)
         gdriverepos[gs.repo_hash()] = gs
     return gdriverepos
Exemple #2
0
 def get_gdrive_repos(self):
     gdriverepo_paths = GDriveSync.scan_repo_paths(
         [os.path.expanduser(SyncHandler.LOC)])
     gdriverepos = {}
     for repopath in gdriverepo_paths:
         gs = GDriveSync(repopath)
         gdriverepos[gs.repo_hash()] = gs
     return gdriverepos
Exemple #3
0
 def action_addgdrive(self):
     self.set_gdrive_auth_tok()
     retcode = 0
     gfolder = self.get_argument('repo', '').strip()
     loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip())
     loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc)
     GDriveSync.clone(gfolder, loc, True)
     return retcode
Exemple #4
0
 def action_addgdrive(self):
     self.set_gdrive_auth_tok()
     retcode = 0
     gfolder = self.get_argument('repo', '').strip()
     loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip())
     loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc)
     GDriveSync.clone(gfolder, loc, True)
     return retcode
Exemple #5
0
 def action_addgdrive(self):
     self.set_gdrive_auth_tok()
     retcode = 0
     gfolder = self.get_argument('repo', '').strip()
     loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip())
     loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc)
     # clone gdrive to local
     GDriveSync.clone(gfolder, loc, False)
     # sync existing local files to gdrive
     gs = GDriveSync(loc)
     gs.sync()
     return retcode
Exemple #6
0
    def set_gtok(self):
        tokfile = self.settings['token_file']

        self.logger.debug('Checking for auth token at ' + tokfile)
        if not os.path.exists(tokfile):
            self.logger.debug('Auth token does not exist at ' + tokfile)
            raise Exception('No authentication token found')

        self.logger.debug('Reading auth token from ' + tokfile)
        with open(tokfile, 'r') as gtok_file:
            credsb64 = gtok_file.read()
            self.logger.debug('Initializing drive creds')
            GDriveSync.init_creds(credsb64)
Exemple #7
0
 def action_addgdrive(self):
     self.set_gdrive_auth_tok()
     retcode = 0
     gfolder = self.get_argument('repo', '').strip()
     loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip())
     loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc)
     # clone gdrive to local
     GDriveSync.clone(gfolder, loc, False)
     # sync existing local files to gdrive
     gs = GDriveSync(loc)
     gs.sync()
     return retcode
Exemple #8
0
 def set_gdrive_auth_tok(self):
     gauth = self.get_argument('gauth', '')
     if len(gauth) > 0:
         GDriveSync.init_creds(gauth)
Exemple #9
0
 def set_gdrive_auth_tok(self):
     gauth = self.get_argument('gauth', '')
     if len(gauth) > 0:
         GDriveSync.init_creds(gauth)