fix #2993 格式错误和传参警告

This commit is contained in:
jxxghp
2024-11-03 19:51:43 +08:00
parent cfc51c305b
commit df8531e4d8
6 changed files with 31 additions and 32 deletions

View File

@@ -280,13 +280,13 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
if not server:
return []
return server.get_latest(num=count, username=username)
def mediaserver_latest_images(self,
server: str,
count: int = 20,
username: str = None,
host_type: bool = True,
) -> List[str]:
def mediaserver_latest_images(self,
server: str = None,
count: int = 20,
username: str = None,
host_type: bool = True,
) -> List[str]:
"""
获取媒体服务器最新入库条目的图片
@@ -299,7 +299,7 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
server: Emby = self.get_instance(server)
if not server:
return []
links = []
items: List[schemas.MediaServerPlayItem] = self.mediaserver_latest(num=count, username=username)
for item in items:
@@ -311,4 +311,3 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
links.append(item.image)
return links

View File

@@ -278,13 +278,13 @@ class JellyfinModule(_ModuleBase, _MediaServerBase[Jellyfin]):
if not server:
return []
return server.get_latest(num=count, username=username)
def mediaserver_latest_images(self,
server: str,
count: int = 20,
username: str = None,
host_type: bool = True,
) -> List[str]:
def mediaserver_latest_images(self,
server: str = None,
count: int = 20,
username: str = None,
host_type: bool = True,
) -> List[str]:
"""
获取媒体服务器最新入库条目的图片
@@ -297,11 +297,11 @@ class JellyfinModule(_ModuleBase, _MediaServerBase[Jellyfin]):
server: Jellyfin = self.get_instance(server)
if not server:
return []
links = []
items: List[schemas.MediaServerPlayItem] = self.mediaserver_latest(num=count, username=username)
for item in items:
link = server.generate_image_link(item_id=item.id, image_type="Backdrop",host_type=host_type)
link = server.generate_image_link(item_id=item.id, image_type="Backdrop", host_type=host_type)
if link:
links.append(link)

View File

@@ -274,11 +274,11 @@ class PlexModule(_ModuleBase, _MediaServerBase[Plex]):
return []
return server.get_latest(num=count)
def mediaserver_latest_images(self,
server: str,
count: int = 20,
username: str = None,
) -> List[str]:
def mediaserver_latest_images(self,
server: str = None,
count: int = 20,
username: str = None,
) -> List[str]:
"""
获取媒体服务器最新入库条目的图片
@@ -290,18 +290,18 @@ class PlexModule(_ModuleBase, _MediaServerBase[Plex]):
server: Plex = self.get_instance(server)
if not server:
return []
links = []
items: List[schemas.MediaServerPlayItem] = self.mediaserver_latest(num=count, username=username)
for item in items:
link = server.get_remote_image_by_id(item_id=item.id,
link = server.get_remote_image_by_id(item_id=item.id,
image_type="Backdrop",
plex_url=False)
if link:
links.append(link)
return links
def mediaserver_play_url(self, server: str, item_id: Union[str, int]) -> Optional[str]:
"""
获取媒体库播放地址