mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
feat: transType API
- 针对查询可用整理方式的API
This commit is contained in:
@@ -205,3 +205,20 @@ def usage(name: str, _: User = Depends(get_current_active_superuser)) -> Any:
|
|||||||
if ret:
|
if ret:
|
||||||
return ret
|
return ret
|
||||||
return schemas.StorageUsage()
|
return schemas.StorageUsage()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/transtype/{name}", summary="支持的整理方式获取", response_model=schemas.StorageTransType)
|
||||||
|
def transtype(name: str, _: User = Depends(get_current_active_superuser)) -> Any:
|
||||||
|
"""
|
||||||
|
查询支持的整理方式
|
||||||
|
"""
|
||||||
|
ret = {}
|
||||||
|
try:
|
||||||
|
ret = StorageChain().support_transtype(name)
|
||||||
|
if ret:
|
||||||
|
return schemas.StorageTransType(transtype=ret)
|
||||||
|
return schemas.StorageTransType()
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
print(schemas.StorageTransType(transtype=ret if ret else []))
|
||||||
|
|||||||
@@ -85,3 +85,9 @@ class StorageChain(ChainBase):
|
|||||||
存储使用情况
|
存储使用情况
|
||||||
"""
|
"""
|
||||||
return self.run_module("storage_usage", storage=storage)
|
return self.run_module("storage_usage", storage=storage)
|
||||||
|
|
||||||
|
def support_transtype(self, storage: str) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
获取支持的整理方式
|
||||||
|
"""
|
||||||
|
return self.run_module("support_transtype", storage=storage)
|
||||||
|
|||||||
@@ -89,6 +89,16 @@ class FileManagerModule(_ModuleBase):
|
|||||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def support_transtype(self, storage: str) -> Optional[Dict[str, str]]:
|
||||||
|
"""
|
||||||
|
支持的整理方式
|
||||||
|
"""
|
||||||
|
storage_oper = self.__get_storage_oper(storage)
|
||||||
|
if not storage_oper:
|
||||||
|
logger.error(f"不支持 {storage} 的整理方式获取")
|
||||||
|
return None
|
||||||
|
return storage_oper.support_transtype()
|
||||||
|
|
||||||
def recommend_name(self, meta: MetaBase, mediainfo: MediaInfo) -> Optional[str]:
|
def recommend_name(self, meta: MetaBase, mediainfo: MediaInfo) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
获取重命名后的名称
|
获取重命名后的名称
|
||||||
|
|||||||
@@ -41,3 +41,8 @@ class StorageUsage(BaseModel):
|
|||||||
total: float = 0.0
|
total: float = 0.0
|
||||||
# 剩余空间
|
# 剩余空间
|
||||||
available: float = 0.0
|
available: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
class StorageTransType(BaseModel):
|
||||||
|
# 传输类型
|
||||||
|
transtype: Optional[dict] = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user