def sync(ctx, localdir, remotedir, encrypt_key, encrypt_type, max_workers, no_show_progress): """同步本地目录到远端""" # Keyboard listener start keyboard_listener_start() api = _recent_api(ctx) if not api: return pwd = _pwd(ctx) remotedir = join_path(pwd, remotedir) encrypt_key = encrypt_key or _encrypt_key(ctx) if encrypt_type != EncryptType.No.name and not encrypt_key: raise ValueError(f"Encrypting with {encrypt_type} must have a key") salt = _salt(ctx) _sync( api, localdir, remotedir, encrypt_key=encrypt_key, salt=salt, encrypt_type=getattr(EncryptType, encrypt_type), max_workers=max_workers, show_progress=not no_show_progress, )
def upload( ctx, localpaths, remotedir, encrypt_password, encrypt_type, max_workers, no_ignore_existing, no_show_progress, check_md5, ): """上传文件""" # Keyboard listener start keyboard_listener_start() api = _recent_api(ctx) if not api: return encrypt_password = encrypt_password or _encrypt_password(ctx) if encrypt_type != EncryptType.No.name and not encrypt_password: raise ValueError(f"Encrypting with {encrypt_type} must have a key") pwd = _pwd(ctx) remotedir = join_path(pwd, remotedir) rapiduploadinfo_file = _rapiduploadinfo_file(ctx) user_id, user_name = _recent_user_id_and_name(ctx) from_to_list = from_tos(localpaths, remotedir) _upload( api, from_to_list, encrypt_password=encrypt_password, encrypt_type=getattr(EncryptType, encrypt_type), max_workers=max_workers, ignore_existing=not no_ignore_existing, show_progress=not no_show_progress, rapiduploadinfo_file=rapiduploadinfo_file, user_id=user_id, user_name=user_name, check_md5=check_md5, )
def sync( ctx, localdir, remotedir, encrypt_password, encrypt_type, max_workers, no_show_progress, check_md5, ): """同步本地目录到远端""" # Keyboard listener start keyboard_listener_start() api = _recent_api(ctx) if not api: return pwd = _pwd(ctx) remotedir = join_path(pwd, remotedir) encrypt_password = encrypt_password or _encrypt_password(ctx) if encrypt_type != EncryptType.No.name and not encrypt_password: raise ValueError(f"Encrypting with {encrypt_type} must have a key") rapiduploadinfo_file = _rapiduploadinfo_file(ctx) user_id, user_name = _recent_user_id_and_name(ctx) _sync( api, localdir, remotedir, encrypt_password=encrypt_password, encrypt_type=getattr(EncryptType, encrypt_type), max_workers=max_workers, show_progress=not no_show_progress, rapiduploadinfo_file=rapiduploadinfo_file, user_id=user_id, user_name=user_name, check_md5=check_md5, )
def upload( ctx, localpaths, remotedir, encrypt_key, encrypt_type, max_workers, no_ignore_existing, no_show_progress, ): """上传文件""" # Keyboard listener start keyboard_listener_start() api = _recent_api(ctx) if not api: return encrypt_key = encrypt_key or _encrypt_key(ctx) if encrypt_type != EncryptType.No.name and not encrypt_key: raise ValueError(f"Encrypting with {encrypt_type} must have a key") salt = _salt(ctx) pwd = _pwd(ctx) remotedir = join_path(pwd, remotedir) from_to_list = from_tos(localpaths, remotedir) _upload( api, from_to_list, encrypt_key=encrypt_key, salt=salt, encrypt_type=getattr(EncryptType, encrypt_type), max_workers=max_workers, ignore_existing=not no_ignore_existing, show_progress=not no_show_progress, )