diff --git a/app/api/endpoints/history.py b/app/api/endpoints/history.py index 0ce21ffd..306e4234 100644 --- a/app/api/endpoints/history.py +++ b/app/api/endpoints/history.py @@ -14,7 +14,7 @@ from app.db.models import User from app.db.models.downloadhistory import DownloadHistory from app.db.models.transferhistory import TransferHistory from app.db.user_oper import get_current_active_superuser_async, get_current_active_superuser -from app.schemas.types import EventType, MediaType +from app.schemas.types import EventType router = APIRouter() @@ -70,7 +70,7 @@ async def transfer_history(title: Optional[str] = None, return schemas.Response(success=True, data={ - "list": result, + "list": [item.to_dict() for item in result], "total": total, }) diff --git a/app/core/config.py b/app/core/config.py index 52f43eee..8a7c84ae 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -621,7 +621,7 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel): return False, f"配置项 '{key}' 不存在" try: - field = self.__fields__[key] + field = Settings.model_fields[key] original_value = getattr(self, key) if field.name == "API_TOKEN": converted_value, needs_update = self.validate_api_token(value, original_value) diff --git a/app/core/context.py b/app/core/context.py index c0b1c84c..c0e3e8b8 100644 --- a/app/core/context.py +++ b/app/core/context.py @@ -257,7 +257,7 @@ class MediaInfo: # 评价数量 vote_count: int = None # 流行度 - popularity: int = None + popularity: float = None # 时长 runtime: int = None # 下一集 diff --git a/app/helper/message.py b/app/helper/message.py index 33ba2568..5e3422d0 100644 --- a/app/helper/message.py +++ b/app/helper/message.py @@ -367,7 +367,6 @@ class TemplateHelper(metaclass=SingletonClass): return rendered return None except Exception as e: - logger.error(f"模板处理失败: {str(e)}") raise ValueError(f"模板处理失败: {str(e)}") from e @staticmethod diff --git a/app/modules/emby/emby.py b/app/modules/emby/emby.py index 7e93faec..a9acebc4 100644 --- a/app/modules/emby/emby.py +++ b/app/modules/emby/emby.py @@ -640,7 +640,7 @@ class Emby: item_type=item.get("Type"), title=item.get("Name"), original_title=item.get("OriginalTitle"), - year=item.get("ProductionYear"), + year=str(item.get("ProductionYear")), tmdbid=int(tmdbid) if tmdbid else None, imdbid=item.get("ProviderIds", {}).get("Imdb"), tvdbid=item.get("ProviderIds", {}).get("Tvdb"), diff --git a/app/modules/jellyfin/jellyfin.py b/app/modules/jellyfin/jellyfin.py index 71ac3be2..25769435 100644 --- a/app/modules/jellyfin/jellyfin.py +++ b/app/modules/jellyfin/jellyfin.py @@ -732,7 +732,7 @@ class Jellyfin: item_type=item.get("Type"), title=item.get("Name"), original_title=item.get("OriginalTitle"), - year=item.get("ProductionYear"), + year=str(item.get("ProductionYear")), tmdbid=int(tmdbid) if tmdbid else None, imdbid=item.get("ProviderIds", {}).get("Imdb"), tvdbid=item.get("ProviderIds", {}).get("Tvdb"), diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index dbed0040..3eec4446 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -437,7 +437,7 @@ class Plex: @staticmethod def __get_ids(guids: List[Any]) -> dict: - def parse_tmdb_id(value: str) -> (bool, int): + def parse_tmdb_id(value: str) -> tuple[bool, int]: """尝试将TMDB ID字符串转换为整数。如果成功,返回(True, int),失败则返回(False, None)。""" try: int_value = int(value) @@ -509,7 +509,7 @@ class Plex: item_type=item.type, title=item.title, original_title=item.originalTitle, - year=item.year, + year=str(item.year), tmdbid=ids.get("tmdb_id"), imdbid=ids.get("imdb_id"), tvdbid=ids.get("tvdb_id"), diff --git a/app/modules/trimemedia/trimemedia.py b/app/modules/trimemedia/trimemedia.py index d8247e23..93a884ee 100644 --- a/app/modules/trimemedia/trimemedia.py +++ b/app/modules/trimemedia/trimemedia.py @@ -437,7 +437,7 @@ class TrimeMedia: item_type=item_type, title=item.title, original_title=item.original_title, - year=year, + year=str(year), tmdbid=item.tmdb_id, imdbid=item.imdb_id, user_state=user_state, diff --git a/app/schemas/context.py b/app/schemas/context.py index 7caeeede..f94d5ff4 100644 --- a/app/schemas/context.py +++ b/app/schemas/context.py @@ -86,7 +86,7 @@ class MediaInfo(BaseModel): # IMDB ID imdb_id: Optional[str] = None # TVDB ID - tvdb_id: Optional[str] = None + tvdb_id: Optional[int] = None # 豆瓣ID douban_id: Optional[str] = None # Bangumi ID @@ -167,7 +167,7 @@ class MediaInfo(BaseModel): # 评价数量 vote_count: Optional[int] = 0 # 流行度 - popularity: Optional[int] = 0 + popularity: Optional[float] = 0.0 # 时长 runtime: Optional[int] = None # 下一集 diff --git a/app/schemas/subscribe.py b/app/schemas/subscribe.py index 5e66a24c..753fac02 100644 --- a/app/schemas/subscribe.py +++ b/app/schemas/subscribe.py @@ -24,7 +24,7 @@ class Subscribe(BaseModel): # 背景图 backdrop: Optional[str] = None # 评分 - vote: Optional[int] = 0 + vote: Optional[float] = 0 # 描述 description: Optional[str] = None # 过滤规则