def _googledrive_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads("GoogleDrive") for k, v in uploadsFromFile.items(): # Check if the file still exists try: with open(v["path"], "r"): pass except IOError: self.pending_uploads["GoogleDrive"][k] = { "error": "File not found", "status": "Error-2", "path": v["path"], } continue if "offset" not in v: self.pending_uploads["GoogleDrive"][k] = { "error": "File not found", "status": "Error-2", "path": v["path"], } continue offset = int(v["offset"]) upload_uri = None if v["upload_uri"] == "None" else v["upload_uri"] gdUploader = GoogleDriveUploader(v["path"], v["destination"], v["parent_id"], offset, upload_uri) self.pending_uploads["GoogleDrive"][k] = { "uploader": gdUploader, "status": v["status"], "conflict": v["conflict"], }
def _dropbox_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads("Dropbox") for k, v in uploadsFromFile.iteritems(): try: with open(v["path"], "r"): pass except IOError: self.pending_uploads["Dropbox"][k] = {"error": "File not found", "status": "Error-2", "path": v["path"]} continue if "offset" not in v: self.pending_uploads["Dropbox"][k] = {"error": "File not found", "status": "Error-2", "path": v["path"]} continue offset = int(v["offset"]) upload_id = None if v["upload_id"] == "None" else v["upload_id"] dbUploader = DropboxUploader(v["path"], v["destination"], offset, upload_id) self.pending_uploads["Dropbox"][k] = { "uploader": dbUploader, "status": v["status"], "conflict": v["conflict"], }
def _dropbox_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads('Dropbox') for k, v in uploadsFromFile.iteritems(): try: with open(v['path'], 'r'): pass except IOError: self.pending_uploads['Dropbox'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue if 'offset' not in v: self.pending_uploads['Dropbox'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue offset = int(v['offset']) upload_id = None if v['upload_id'] == 'None' else v['upload_id'] dbUploader = DropboxUploader(v['path'], v['destination'], offset, upload_id) self.pending_uploads['Dropbox'][k] = { 'uploader': dbUploader, 'status': v['status'], 'conflict': v['conflict'] }
def _pithos_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads('Pithos') for k, v in uploadsFromFile.iteritems(): try: with open(v['path'], 'r'): pass except IOError: self.pending_uploads['Pithos'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue if 'offset' not in v: self.pending_uploads['Pithos'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue offset = int(v['offset']) pithosUploader = PithosUploader(v['path'], v['destination'], offset) self.pending_uploads['Pithos'][k] = { 'uploader': pithosUploader, 'status': v['status'], 'conflict': v['conflict'] }
def _pithos_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads("Pithos") for k, v in uploadsFromFile.iteritems(): try: with open(v["path"], "r"): pass except IOError: self.pending_uploads["Pithos"][k] = {"error": "File not found", "status": "Error-2", "path": v["path"]} continue if "offset" not in v: self.pending_uploads["Pithos"][k] = {"error": "File not found", "status": "Error-2", "path": v["path"]} continue offset = int(v["offset"]) pithosUploader = PithosUploader(v["path"], v["destination"], offset) self.pending_uploads["Pithos"][k] = { "uploader": pithosUploader, "status": v["status"], "conflict": v["conflict"], }
def _googledrive_load(self): uploadManager = LocalUploadManager() uploadsFromFile = uploadManager.get_uploads('GoogleDrive') for k, v in uploadsFromFile.items(): #Check if the file still exists try: with open(v['path'], 'r'): pass except IOError: self.pending_uploads['GoogleDrive'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue if 'offset' not in v: self.pending_uploads['GoogleDrive'][k] = { 'error': 'File not found', 'status': 'Error-2', 'path': v['path'] } continue offset = int(v['offset']) upload_uri = None if v['upload_uri'] == 'None' else v['upload_uri'] gdUploader = GoogleDriveUploader(v['path'], v['destination'], v['parent_id'], offset, upload_uri) self.pending_uploads['GoogleDrive'][k] = { 'uploader': gdUploader, 'status': v['status'], 'conflict': v['conflict'] }