diff --git a/app/api/endpoints/mediaserver.py b/app/api/endpoints/mediaserver.py index 7bd6b4ff..cc716ab0 100644 --- a/app/api/endpoints/mediaserver.py +++ b/app/api/endpoints/mediaserver.py @@ -120,7 +120,7 @@ def not_exists(media_in: schemas.MediaInfo, @router.get("/latest", summary="最新入库条目", response_model=List[schemas.MediaServerPlayItem]) -def latest(count: int = 20, +def latest(count: int = 18, _: schemas.TokenPayload = Depends(verify_token)) -> Any: """ 获取媒体服务器最新入库条目 @@ -132,7 +132,7 @@ def latest(count: int = 20, @router.get("/playing", summary="正在播放条目", response_model=List[schemas.MediaServerPlayItem]) -def playing(count: int = 20, +def playing(count: int = 18, _: schemas.TokenPayload = Depends(verify_token)) -> Any: """ 获取媒体服务器正在播放条目 diff --git a/app/modules/emby/emby.py b/app/modules/emby/emby.py index 10105185..438db3fd 100644 --- a/app/modules/emby/emby.py +++ b/app/modules/emby/emby.py @@ -951,7 +951,7 @@ class Emby(metaclass=Singleton): """ if not self._host or not self._apikey: return "" - return "%sItems/%s/Images/Primary" % (self._host, item_id) + return "%sItems/%s/Images/Primary" % (self._playhost or self._host, item_id) def get_resume(self, num: int = 12) -> Optional[List[schemas.MediaServerPlayItem]]: """ @@ -972,14 +972,10 @@ class Emby(metaclass=Singleton): link = self.get_play_url(item.get("Id")) if item_type == MediaType.MOVIE.value: title = item.get("Name") - subtitle = item.get("Year") + subtitle = item.get("ProductionYear") else: - if item.get("ParentIndexNumber") == 1: - title = f'{item.get("SeriesName")}' - subtitle = f'第{item.get("IndexNumber")}集' - else: - title = f'{item.get("SeriesName")}' - subtitle = f'第{item.get("ParentIndexNumber")}季 第{item.get("IndexNumber")}集' + title = f'{item.get("SeriesName")}' + subtitle = f'S{item.get("ParentIndexNumber")}:{item.get("IndexNumber")} - {item.get("Name")}' if item_type == MediaType.MOVIE.value: if item.get("BackdropImageTags"): image = self.__get_backdrop_url(item_id=item.get("Id"), @@ -1028,6 +1024,7 @@ class Emby(metaclass=Singleton): ret_latest.append(schemas.MediaServerPlayItem( id=item.get("Id"), title=item.get("Name"), + subtitle=item.get("ProductionYear"), type=item_type, image=image, link=link diff --git a/app/modules/jellyfin/jellyfin.py b/app/modules/jellyfin/jellyfin.py index 7ce17b3a..510451d5 100644 --- a/app/modules/jellyfin/jellyfin.py +++ b/app/modules/jellyfin/jellyfin.py @@ -619,7 +619,7 @@ class Jellyfin(metaclass=Singleton): """ if not self._host or not self._apikey: return "" - return "%sItems/%s/Images/Primary" % (self._host, item_id) + return "%sItems/%s/Images/Primary" % (self._playhost or self._host, item_id) def __get_backdrop_url(self, item_id: str, image_tag: str) -> str: """ @@ -660,14 +660,10 @@ class Jellyfin(metaclass=Singleton): image = self.__get_local_image_by_id(item.get("Id")) if item_type == MediaType.MOVIE.value: title = item.get("Name") - subtitle = item.get("Year") + subtitle = item.get("ProductionYear") else: - if item.get("ParentIndexNumber") == 1: - title = f'{item.get("SeriesName")}' - subtitle = f'第{item.get("IndexNumber")}集' - else: - title = f'{item.get("SeriesName")}' - subtitle = f'第{item.get("ParentIndexNumber")}季 第{item.get("IndexNumber")}集' + title = f'{item.get("SeriesName")}' + subtitle = f'S{item.get("ParentIndexNumber")}:{item.get("IndexNumber")} - {item.get("Name")}' ret_resume.append(schemas.MediaServerPlayItem( id=item.get("Id"), title=title, @@ -705,6 +701,7 @@ class Jellyfin(metaclass=Singleton): ret_latest.append(schemas.MediaServerPlayItem( id=item.get("Id"), title=item.get("Name"), + subtitle=item.get("ProductionYear"), type=item_type, image=image, link=link diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index d0c86a2c..5eaf6464 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -615,12 +615,8 @@ class Plex(metaclass=Singleton): title = item.title subtitle = item.year else: - if item.parentIndex == 1: - title = item.grandparentTitle - subtitle = f"第{item.index}集" - else: - title = item.grandparentTitle - subtitle = f"第{item.parentIndex}季 第{item.index}集" + title = item.grandparentTitle + subtitle = f"S{item.parentIndex}:E{item.index} - {item.title}" link = self.get_play_url(item.key) image = item.artUrl ret_resume.append(schemas.MediaServerPlayItem( @@ -651,6 +647,7 @@ class Plex(metaclass=Singleton): ret_resume.append(schemas.MediaServerPlayItem( id=item.key, title=title, + subtitle=item.year, type=item_type, image=image, link=link