diff --git a/app/core/context.py b/app/core/context.py index 971fc32f..7e7cdcf5 100644 --- a/app/core/context.py +++ b/app/core/context.py @@ -1,6 +1,6 @@ import re from dataclasses import dataclass, field, asdict -from typing import List, Dict +from typing import List, Dict, Any from app.core.config import settings from app.core.meta import MetaBase @@ -55,6 +55,12 @@ class TorrentInfo: # 种子优先级 pri_order: int = 0 + def __getattr__(self, attribute): + return None + + def __setattr__(self, name: str, value: Any): + self.__dict__[name] = value + def __get_properties(self): """ 获取属性列表 @@ -169,6 +175,12 @@ class MediaInfo: if self.douban_info: self.set_douban_info(self.douban_info) + def __getattr__(self, attribute): + return None + + def __setattr__(self, name: str, value: Any): + self.__dict__[name] = value + def __get_properties(self): """ 获取属性列表 @@ -508,6 +520,12 @@ class Context: # 种子信息 torrent_info: TorrentInfo = None + def __getattr__(self, attribute): + return None + + def __setattr__(self, name: str, value: Any): + self.__dict__[name] = value + def to_dict(self): """ 转换为字典