mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix schemas
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
from dataclasses import dataclass, field, asdict
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Dict, Any, Tuple
|
from typing import List, Dict, Any, Tuple
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class TorrentInfo:
|
|||||||
"""
|
"""
|
||||||
返回字典
|
返回字典
|
||||||
"""
|
"""
|
||||||
dicts = asdict(self)
|
dicts = vars(self).copy()
|
||||||
dicts["volume_factor"] = self.volume_factor
|
dicts["volume_factor"] = self.volume_factor
|
||||||
dicts["freedate_diff"] = self.freedate_diff
|
dicts["freedate_diff"] = self.freedate_diff
|
||||||
return dicts
|
return dicts
|
||||||
@@ -740,7 +740,7 @@ class MediaInfo:
|
|||||||
"""
|
"""
|
||||||
返回字典
|
返回字典
|
||||||
"""
|
"""
|
||||||
dicts = asdict(self)
|
dicts = vars(self).copy()
|
||||||
dicts["type"] = self.type.value if self.type else None
|
dicts["type"] = self.type.value if self.type else None
|
||||||
dicts["detail_link"] = self.detail_link
|
dicts["detail_link"] = self.detail_link
|
||||||
dicts["title_year"] = self.title_year
|
dicts["title_year"] = self.title_year
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ from .rule import *
|
|||||||
from .system import *
|
from .system import *
|
||||||
from .file import *
|
from .file import *
|
||||||
from .exception import *
|
from .exception import *
|
||||||
|
from .system import *
|
||||||
|
|||||||
+35
-4
@@ -1,9 +1,10 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional, List
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from app.core.meta import MetaBase
|
from app.schemas import TmdbEpisode, MetaInfo, MediaInfo
|
||||||
|
from app.schemas.system import TransferDirectoryConf
|
||||||
from app.schemas.file import FileItem
|
from app.schemas.file import FileItem
|
||||||
|
|
||||||
|
|
||||||
@@ -46,12 +47,32 @@ class TransferTask(BaseModel):
|
|||||||
文件整理任务
|
文件整理任务
|
||||||
"""
|
"""
|
||||||
fileitem: Optional[FileItem] = None
|
fileitem: Optional[FileItem] = None
|
||||||
meta: Optional[MetaBase] = None
|
meta: Optional[MetaInfo] = None
|
||||||
|
mediainfo: Optional[MediaInfo] = None
|
||||||
|
target_directory: Optional[TransferDirectoryConf] = None
|
||||||
|
target_storage: Optional[str] = None
|
||||||
|
target_path: Optional[Path] = None
|
||||||
|
transfer_type: Optional[str] = None
|
||||||
|
scrape: Optional[bool] = None
|
||||||
|
library_type_folder: Optional[bool] = None
|
||||||
|
library_category_folder: Optional[bool] = None
|
||||||
|
episodes_info: Optional[List[TmdbEpisode]] = None
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""
|
||||||
|
返回字典
|
||||||
|
"""
|
||||||
|
dicts = vars(self).copy()
|
||||||
|
dicts["fileitem"] = self.fileitem.dict() if self.fileitem else None
|
||||||
|
dicts["meta"] = self.meta.dict() if self.meta else None
|
||||||
|
dicts["mediainfo"] = self.mediainfo.dict() if self.mediainfo else None
|
||||||
|
dicts["target_directory"] = self.target_directory.dict() if self.target_directory else None
|
||||||
|
return dicts
|
||||||
|
|
||||||
|
|
||||||
class TransferInfo(BaseModel):
|
class TransferInfo(BaseModel):
|
||||||
"""
|
"""
|
||||||
文件整理结果信息
|
文件整理结果
|
||||||
"""
|
"""
|
||||||
# 是否成功标志
|
# 是否成功标志
|
||||||
success: bool = True
|
success: bool = True
|
||||||
@@ -90,6 +111,16 @@ class TransferInfo(BaseModel):
|
|||||||
return dicts
|
return dicts
|
||||||
|
|
||||||
|
|
||||||
|
class AsyncTransferCallback(BaseModel):
|
||||||
|
"""
|
||||||
|
异步整理回调信息
|
||||||
|
"""
|
||||||
|
# 任务信息
|
||||||
|
task: Optional[TransferTask] = None
|
||||||
|
# 结果信息
|
||||||
|
result: Optional[TransferInfo] = None
|
||||||
|
|
||||||
|
|
||||||
class EpisodeFormat(BaseModel):
|
class EpisodeFormat(BaseModel):
|
||||||
"""
|
"""
|
||||||
剧集自定义识别格式
|
剧集自定义识别格式
|
||||||
|
|||||||
Reference in New Issue
Block a user