Merge branch 'jxxghp:v2' into v2

This commit is contained in:
Sowevo
2024-11-19 22:43:31 +08:00
committed by GitHub
6 changed files with 36 additions and 32 deletions

View File

@@ -213,7 +213,7 @@ class Alist(StorageBase):
path=(Path(fileitem.path) / item["name"]).as_posix() + ("/" if item["is_dir"] else ""),
name=item["name"],
basename=Path(item["name"]).stem,
extension=Path(item["name"]).suffix if not item["is_dir"] else None,
extension=Path(item["name"]).suffix[1:] if not item["is_dir"] else None,
size=item["size"] if not item["is_dir"] else None,
modify_time=self.__parse_timestamp(item["modified"]),
thumbnail=item["thumb"],
@@ -351,7 +351,7 @@ class Alist(StorageBase):
path=path.as_posix() + ("/" if result["data"]["is_dir"] else ""),
name=result["data"]["name"],
basename=Path(result["data"]["name"]).stem,
extension=Path(result["data"]["name"]).suffix,
extension=Path(result["data"]["name"]).suffix[1:],
size=result["data"]["size"],
modify_time=self.__parse_timestamp(result["data"]["modified"]),
thumbnail=result["data"]["thumb"],
@@ -521,13 +521,15 @@ class Alist(StorageBase):
).get_res(download_url)
if not path:
path = settings.TEMP_PATH / fileitem.name
new_path = settings.TEMP_PATH / fileitem.name
else:
new_path = path / fileitem.name
with open(path, "wb") as f:
with open(new_path, "wb") as f:
f.write(resp.content)
if path.exists():
return path
if new_path.exists():
return new_path
return None
def upload(

View File

@@ -21,7 +21,8 @@ class U115Pan(StorageBase, metaclass=Singleton):
# 支持的整理方式
transtype = {
"move": "移动"
"move": "移动",
"copy": "复制"
}
client: P115Client = None
@@ -34,7 +35,8 @@ class U115Pan(StorageBase, metaclass=Singleton):
"""
try:
if not self.client or not self.client.cookies or force:
self.client = P115Client(self.__credential)
self.client = P115Client(self.__credential,
check_for_relogin=True, app="alipaymini", console_qrcode=False)
self.fs = P115FileSystem(self.client)
except Exception as err:
logger.error(f"115连接失败请重新扫码登录{str(err)}")