mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor(string): split utilities by responsibility
This commit is contained in:
@@ -17,7 +17,7 @@ from app.schemas.exception import StorageQueryError
|
||||
from app.schemas.types import StorageSchema
|
||||
from app.adapters.network.http import RequestUtils
|
||||
from app.foundation.singleton import WeakSingleton
|
||||
from app.domain.string import StringUtils
|
||||
from app.foundation import temporal as time_tools
|
||||
|
||||
lock = threading.Lock()
|
||||
|
||||
@@ -305,7 +305,7 @@ class AliPan(StorageBase, metaclass=WeakSingleton):
|
||||
name=fileinfo.get("name"),
|
||||
basename=fileinfo.get("name"),
|
||||
size=fileinfo.get("size"),
|
||||
modify_time=StringUtils.str_to_timestamp(fileinfo.get("updated_at")),
|
||||
modify_time=time_tools.parse_timestamp(fileinfo.get("updated_at")),
|
||||
drive_id=fileinfo.get("drive_id"),
|
||||
)
|
||||
else:
|
||||
@@ -319,7 +319,7 @@ class AliPan(StorageBase, metaclass=WeakSingleton):
|
||||
basename=Path(fileinfo.get("name")).stem,
|
||||
size=fileinfo.get("size"),
|
||||
extension=fileinfo.get("file_extension"),
|
||||
modify_time=StringUtils.str_to_timestamp(fileinfo.get("updated_at")),
|
||||
modify_time=time_tools.parse_timestamp(fileinfo.get("updated_at")),
|
||||
thumbnail=fileinfo.get("thumbnail"),
|
||||
drive_id=fileinfo.get("drive_id"),
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.runtime.log import logger
|
||||
from app.modules.filemanager.storages import StorageBase, transfer_process
|
||||
from app.schemas.exception import StorageQueryError
|
||||
from app.schemas.types import StorageSchema
|
||||
from app.domain.string import StringUtils
|
||||
from app.foundation import temporal as time_tools
|
||||
from app.adapters.system.host import SystemUtils
|
||||
|
||||
_MAX_FOLDER_LOCKS = 4096
|
||||
@@ -127,7 +127,7 @@ class Rclone(StorageBase):
|
||||
path=f"{parent}{item.get('Name')}" + "/",
|
||||
name=item.get("Name"),
|
||||
basename=item.get("Name"),
|
||||
modify_time=StringUtils.str_to_timestamp(item.get("ModTime"))
|
||||
modify_time=time_tools.parse_timestamp(item.get("ModTime"))
|
||||
)
|
||||
else:
|
||||
return schemas.FileItem(
|
||||
@@ -138,7 +138,7 @@ class Rclone(StorageBase):
|
||||
basename=Path(item.get("Name")).stem,
|
||||
extension=Path(item.get("Name")).suffix[1:],
|
||||
size=item.get("Size"),
|
||||
modify_time=StringUtils.str_to_timestamp(item.get("ModTime"))
|
||||
modify_time=time_tools.parse_timestamp(item.get("ModTime"))
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -20,7 +20,7 @@ from app.modules.filemanager.storages import transfer_process
|
||||
from app.schemas.exception import StorageQueryError
|
||||
from app.schemas.types import StorageSchema
|
||||
from app.foundation.singleton import WeakSingleton
|
||||
from app.domain.string import StringUtils
|
||||
from app.foundation import size as size_tools
|
||||
from app.runtime.rate import QpsRateLimiter, RateStats
|
||||
|
||||
|
||||
@@ -690,7 +690,7 @@ class U115Pan(StorageBase, metaclass=WeakSingleton):
|
||||
if info_resp["file_category"] == "1"
|
||||
else None,
|
||||
pickcode=info_resp["pick_code"],
|
||||
size=StringUtils.num_filesize(info_resp["size"])
|
||||
size=size_tools.parse_size(info_resp["size"])
|
||||
if info_resp["file_category"] == "1"
|
||||
else None,
|
||||
modify_time=info_resp["utime"],
|
||||
@@ -742,7 +742,7 @@ class U115Pan(StorageBase, metaclass=WeakSingleton):
|
||||
|
||||
# 初始化进度条
|
||||
logger.info(
|
||||
f"【115】开始上传: {local_path} -> {target_path},分片大小:{StringUtils.str_filesize(part_size)}"
|
||||
f"【115】开始上传: {local_path} -> {target_path},分片大小:{size_tools.format_compact_size(part_size)}"
|
||||
)
|
||||
progress_callback = transfer_process(local_path.as_posix())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user