This commit is contained in:
jxxghp 2024-01-05 20:21:19 +08:00
parent cfb029b6b4
commit bc4931d971
4 changed files with 15 additions and 24 deletions

View File

@ -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:
"""
获取媒体服务器正在播放条目

View File

@ -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

View File

@ -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

View File

@ -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