def dump_compress_database(self): dump_file_path = os.path.join(self.current_folder, '%s.dump' % self.project) dump(self.project.title, open(dump_file_path, 'w'), self.log) self.log.info('Dumped to %s' % get_size(dump_file_path)) self.log.info('Compressing database') dump_tarfile_path = '%s.tar.gz' % dump_file_path compress_file(dump_file_path, dump_tarfile_path, self.log) os.remove(dump_file_path) self.log.info('Compressed to %s' % get_size(dump_tarfile_path))
def __init__(self, app, action = '', func = None, lst = [], *args): if func in ['copy', 'backup']: func, action = self.copy, 'Copying files' elif func in ['move', 'rename']: func, action = self.move, 'Moving files' #initilize size to copy self.total_size , self.cur_total_size = 0,0 self.cur_dest_size, self.cur_source_size = 0,0 self.dest_file = '' self.src_file = '' #self.time = 0 #self.speed = 0 #self.cur_size_previous = 0 #self.time_previous = 0 self.cur_tim, self.prev_tim = 0, 0 for i in range(len(lst)): self.total_size += files.get_size(os.path.join(args[0],lst[i])) ProcessBaseLoop.__init__(self, app, action, func, lst, *args) self.overwrite_all = not self.app.prefs.confirmations['overwrite'] self.overwrite_none = False
def __init__(self, app, action='', func=None, lst=[], *args): if func in ['copy', 'backup']: func, action = self.copy, 'Copying files' elif func in ['move', 'rename']: func, action = self.move, 'Moving files' #initilize size to copy self.total_size, self.cur_total_size = 0, 0 self.cur_dest_size, self.cur_source_size = 0, 0 self.dest_file = '' self.src_file = '' #self.time = 0 #self.speed = 0 #self.cur_size_previous = 0 #self.time_previous = 0 self.cur_tim, self.prev_tim = 0, 0 for i in range(len(lst)): self.total_size += files.get_size(os.path.join(args[0], lst[i])) ProcessBaseLoop.__init__(self, app, action, func, lst, *args) self.overwrite_all = not self.app.prefs.confirmations['overwrite'] self.overwrite_none = False
def __init__(self, app, func = None, lst = [], *args): self.app = app #self.unpack_flag = False if func == 'comp_dir': func = self.do_compress_uncompress_dir action= 'Compressing directory' elif func == 'uncomp_dir': func = self.do_compress_uncompress_dir action = 'Uncompressing directory' #self.unpack_flag = True elif func == 'ucomp_file': func = self.do_compress_uncompress_file action = '(Un)Compressing file' #elif func == 'uncomp_vfs': #func = self.do_compress_uncompress_dir #action = 'Creating archive VFS' ##self.unpack_flag = True #elif func == 'comp_vfs': #func = self.do_compress_vfs #action = 'Rebuilding archive' else: return #self.source_file = args[0]+os.sep+lst[0] self.source_file = os.path.join(args[0], lst[0]) self.source_size = files.get_size(self.source_file) ProcessBaseLoop.__init__(self, app, action, func, lst, *args)
def __init__(self, app, func=None, lst=[], *args): self.app = app #self.unpack_flag = False if func == 'comp_dir': func = self.do_compress_uncompress_dir action = 'Compressing directory' elif func == 'uncomp_dir': func = self.do_compress_uncompress_dir action = 'Uncompressing directory' #self.unpack_flag = True elif func == 'ucomp_file': func = self.do_compress_uncompress_file action = '(Un)Compressing file' #elif func == 'uncomp_vfs': #func = self.do_compress_uncompress_dir #action = 'Creating archive VFS' ##self.unpack_flag = True #elif func == 'comp_vfs': #func = self.do_compress_vfs #action = 'Rebuilding archive' else: return #self.source_file = args[0]+os.sep+lst[0] self.source_file = os.path.join(args[0], lst[0]) self.source_size = files.get_size(self.source_file) ProcessBaseLoop.__init__(self, app, action, func, lst, *args)
def compress_media(self): self.log.info('Collecting media files') output_media_tarfile = os.path.join(self.current_folder, 'media.tar') old_incremental_file = '%s.inc' % get_backup_index(self.project.title, 1, self.b_time.month, self.b_time.year) old_incremental_file = os.path.join(self.b_folder, old_incremental_file) if not os.path.isfile(old_incremental_file): open(old_incremental_file, 'w').close() incremental_file = old_incremental_file.replace('.inc', '.new.inc') shutil.copy(old_incremental_file, incremental_file) incremental_compress(self.project.media_folder, output_media_tarfile, incremental_file, self.b_compress_log_f, self.log) self.log.info('Incremental media files archive size: %s' % get_size(output_media_tarfile)) shutil.move(incremental_file, incremental_file.replace('.new.inc', '.inc'))