Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Sep 23, 2024
1 parent d7c277a commit 1a3d88f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions app/db/mediaserver_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1a3d88f

Please sign in to comment.