diff --git a/app/core/config.py b/app/core/config.py index b9cada123..819a6ca01 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -199,6 +199,14 @@ def convert_int(cls, value): except (ValueError, TypeError): raise ValueError(f"{value} 格式错误,不是有效数字!") + @validator("COOKIECLOUD_ENABLE_LOCAL", + "SUBSCRIBE_SEARCH", + pre=True, always=True) + def convert_boolean(cls, value): + if not value: + return False + return True + @validator("API_TOKEN", pre=True, always=True) def validate_api_token(cls, v): if not v: diff --git a/app/db/mediaserver_oper.py b/app/db/mediaserver_oper.py index d22e45042..6f8e5d962 100644 --- a/app/db/mediaserver_oper.py +++ b/app/db/mediaserver_oper.py @@ -19,6 +19,8 @@ def add(self, **kwargs) -> bool: """ 新增媒体服务器数据 """ + # MediaServerItem中没有的属性剔除 + kwargs = {k: v for k, v in kwargs.items() if hasattr(MediaServerItem, k)} item = MediaServerItem(**kwargs) if not item.get_by_itemid(self._db, kwargs.get("item_id")): item.create(self._db)