fix storage

This commit is contained in:
jxxghp
2024-06-30 18:44:23 +08:00
parent a62ca9a226
commit a7b906ada6
9 changed files with 164 additions and 114 deletions

View File

@@ -3,7 +3,6 @@ import os
import platform
import re
import shutil
import subprocess
import sys
from pathlib import Path
from typing import List, Union, Tuple
@@ -144,54 +143,6 @@ class SystemUtils:
print(str(err))
return -1, str(err)
@staticmethod
def rclone_move(src: Path, dest: Path):
"""
Rclone移动
"""
try:
retcode = subprocess.run(
[
'rclone', 'moveto',
str(src),
f'MP:{dest}'
],
startupinfo=SystemUtils.__get_hidden_shell()
).returncode
return retcode, ""
except Exception as err:
print(str(err))
return -1, str(err)
@staticmethod
def rclone_copy(src: Path, dest: Path):
"""
Rclone复制
"""
try:
retcode = subprocess.run(
[
'rclone', 'copyto',
str(src),
f'MP:{dest}'
],
startupinfo=SystemUtils.__get_hidden_shell()
).returncode
return retcode, ""
except Exception as err:
print(str(err))
return -1, str(err)
@staticmethod
def __get_hidden_shell():
if SystemUtils.is_windows():
st = subprocess.STARTUPINFO()
st.dwFlags = subprocess.STARTF_USESHOWWINDOW
st.wShowWindow = subprocess.SW_HIDE
return st
else:
return None
@staticmethod
def list_files(directory: Path, extensions: list, min_filesize: int = 0) -> List[Path]:
"""