mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +08:00
fix storage api
This commit is contained in:
@@ -361,7 +361,8 @@ class AliPan(StorageBase):
|
|||||||
parent_fileid="root",
|
parent_fileid="root",
|
||||||
type="dir",
|
type="dir",
|
||||||
path="/资源库/",
|
path="/资源库/",
|
||||||
name="资源库"
|
name="资源库",
|
||||||
|
basename="资源库"
|
||||||
),
|
),
|
||||||
schemas.FileItem(
|
schemas.FileItem(
|
||||||
storage=self.schema.value,
|
storage=self.schema.value,
|
||||||
@@ -370,9 +371,13 @@ class AliPan(StorageBase):
|
|||||||
parent_fileid="root",
|
parent_fileid="root",
|
||||||
type="dir",
|
type="dir",
|
||||||
path="/备份盘/",
|
path="/备份盘/",
|
||||||
name="备份盘"
|
name="备份盘",
|
||||||
|
basename="备份盘"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
# 如果本身是文件
|
||||||
|
if fileitem.type == "file":
|
||||||
|
return [fileitem]
|
||||||
# 返回数据
|
# 返回数据
|
||||||
ret_items = []
|
ret_items = []
|
||||||
# 分页获取
|
# 分页获取
|
||||||
@@ -413,6 +418,7 @@ class AliPan(StorageBase):
|
|||||||
type="dir" if fileinfo.get("type") == "folder" else "file",
|
type="dir" if fileinfo.get("type") == "folder" else "file",
|
||||||
path=f"{fileitem.path}{fileinfo.get('name')}" + ("/" if fileinfo.get("type") == "folder" else ""),
|
path=f"{fileitem.path}{fileinfo.get('name')}" + ("/" if fileinfo.get("type") == "folder" else ""),
|
||||||
name=fileinfo.get("name"),
|
name=fileinfo.get("name"),
|
||||||
|
basename=Path(fileinfo.get("name")).stem,
|
||||||
size=fileinfo.get("size"),
|
size=fileinfo.get("size"),
|
||||||
extension=fileinfo.get("file_extension"),
|
extension=fileinfo.get("file_extension"),
|
||||||
modify_time=StringUtils.str_to_timestamp(fileinfo.get("updated_at")),
|
modify_time=StringUtils.str_to_timestamp(fileinfo.get("updated_at")),
|
||||||
@@ -604,7 +610,14 @@ class AliPan(StorageBase):
|
|||||||
if not download_url:
|
if not download_url:
|
||||||
logger.warn(f"{fileitem.path} 未获取到下载链接")
|
logger.warn(f"{fileitem.path} 未获取到下载链接")
|
||||||
return None
|
return None
|
||||||
res = RequestUtils().get_res(download_url)
|
res = RequestUtils(headers={
|
||||||
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
|
"Referer": "https://www.alipan.com/",
|
||||||
|
"Sec-Fetch-Dest": "iframe",
|
||||||
|
"Sec-Fetch-Mode": "navigate",
|
||||||
|
"Sec-Fetch-Site": "cross-site",
|
||||||
|
"User-Agent": settings.USER_AGENT
|
||||||
|
}).get_res(download_url)
|
||||||
if res:
|
if res:
|
||||||
path = settings.TEMP_PATH / fileitem.name
|
path = settings.TEMP_PATH / fileitem.name
|
||||||
with path.open("wb") as f:
|
with path.open("wb") as f:
|
||||||
|
|||||||
@@ -96,15 +96,17 @@ class Rclone(StorageBase):
|
|||||||
logger.error(f"rclone存储检查失败:{err}")
|
logger.error(f"rclone存储检查失败:{err}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def list(self, fileitm: schemas.FileItem) -> Optional[List[schemas.FileItem]]:
|
def list(self, fileitem: schemas.FileItem) -> Optional[List[schemas.FileItem]]:
|
||||||
"""
|
"""
|
||||||
浏览文件
|
浏览文件
|
||||||
"""
|
"""
|
||||||
|
if fileitem.type == "file":
|
||||||
|
return [fileitem]
|
||||||
try:
|
try:
|
||||||
ret = subprocess.run(
|
ret = subprocess.run(
|
||||||
[
|
[
|
||||||
'rclone', 'lsjson',
|
'rclone', 'lsjson',
|
||||||
f'MP:{fileitm.path}'
|
f'MP:{fileitem.path}'
|
||||||
],
|
],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
startupinfo=self.__get_hidden_shell()
|
startupinfo=self.__get_hidden_shell()
|
||||||
|
|||||||
@@ -162,6 +162,8 @@ class U115Pan(StorageBase, metaclass=Singleton):
|
|||||||
if not self.__init_cloud():
|
if not self.__init_cloud():
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
|
if fileitem.type == "file":
|
||||||
|
return [fileitem]
|
||||||
items = self.cloud.storage().list(dir_id=fileitem.fileid)
|
items = self.cloud.storage().list(dir_id=fileitem.fileid)
|
||||||
return [schemas.FileItem(
|
return [schemas.FileItem(
|
||||||
storage=self.schema.value,
|
storage=self.schema.value,
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ class WebPushModule(_ModuleBase, _MessageBase):
|
|||||||
for conf in self._configs.values():
|
for conf in self._configs.values():
|
||||||
if not self.checkMessage(message, conf.name):
|
if not self.checkMessage(message, conf.name):
|
||||||
continue
|
continue
|
||||||
webpush_users = conf.config.get("WEBPUSH_USERNAME")
|
webpush_users = conf.config.get("WEBPUSH_USERNAME") or ""
|
||||||
if webpush_users:
|
if webpush_users:
|
||||||
if message.username and message.username != message.userid:
|
# 设定了接收用户时,非该用户的消息不接收
|
||||||
|
if not message.userid or message.userid not in webpush_users.split(","):
|
||||||
continue
|
continue
|
||||||
if not message.title and not message.text:
|
if not message.title and not message.text:
|
||||||
logger.warn("标题和内容不能同时为空")
|
logger.warn("标题和内容不能同时为空")
|
||||||
|
|||||||
Reference in New Issue
Block a user