Merge pull request #42 from yubanmeiqin9048/main
This commit is contained in:
commit
3f8c5fbf48
@ -549,6 +549,7 @@ class MediaInfo:
|
|||||||
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
|
||||||
|
dicts["tmdb_info"]["media_type"] = self.type.value if self.type else None
|
||||||
return dicts
|
return dicts
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
@ -135,10 +135,21 @@ class WebHook(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
if not self._webhook_url:
|
if not self._webhook_url:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def __to_dict(event):
|
||||||
|
result = {}
|
||||||
|
for key, value in event.items():
|
||||||
|
if hasattr(value, 'to_dict'):
|
||||||
|
result[key] = value.to_dict()
|
||||||
|
else:
|
||||||
|
result[key] = str(value)
|
||||||
|
return result
|
||||||
|
|
||||||
event_info = {
|
event_info = {
|
||||||
"type": event.event_type,
|
"type": event.event_type,
|
||||||
"data": str(event.event_data)
|
"data": __to_dict(event.event_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if self._method == 'POST':
|
if self._method == 'POST':
|
||||||
ret = RequestUtils(content_type="application/json").post_res(self._webhook_url, json=event_info)
|
ret = RequestUtils(content_type="application/json").post_res(self._webhook_url, json=event_info)
|
||||||
else:
|
else:
|
||||||
|
@ -4,6 +4,7 @@ from typing import Optional
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TransferTorrent(BaseModel):
|
class TransferTorrent(BaseModel):
|
||||||
"""
|
"""
|
||||||
待转移任务信息
|
待转移任务信息
|
||||||
@ -51,3 +52,12 @@ class TransferInfo(BaseModel):
|
|||||||
fail_list: Optional[list] = []
|
fail_list: Optional[list] = []
|
||||||
# 错误信息
|
# 错误信息
|
||||||
message: Optional[str] = None
|
message: Optional[str] = None
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""
|
||||||
|
返回字典
|
||||||
|
"""
|
||||||
|
dicts = vars(self).copy() # 创建一个字典的副本以避免修改原始数据
|
||||||
|
dicts["path"] = str(self.path) if self.path else None
|
||||||
|
dicts["target_path"] = str(self.target_path) if self.target_path else None
|
||||||
|
return dicts
|
Loading…
x
Reference in New Issue
Block a user