feat(mediaserver): add item count to media library details across multiple servers

This commit is contained in:
jxxghp
2026-06-29 21:37:58 +08:00
parent 302d8bbf5c
commit 4d30dee74c
7 changed files with 8 additions and 0 deletions

View File

@@ -171,6 +171,7 @@ class Emby:
name=library.get("Name"),
path=library.get("Path"),
type=library_type,
item_count=self.get_items_count(library.get("Id")),
image=image,
link=f'{self._playhost or self._host}web/index.html'
f'#!/videos?{server_query}parentId={library.get("Id")}',

View File

@@ -173,6 +173,7 @@ class Jellyfin:
name=library.get("Name"),
path=library.get("Path"),
type=library_type,
item_count=self.get_items_count(library.get("Id")),
image=image,
link=link,
server_type="jellyfin"

View File

@@ -152,6 +152,7 @@ class Plex:
name=library.title,
path=library.locations,
type=library_type,
item_count=self.get_items_count(library.key),
image_list=image_list,
link=f"{self._playhost or self._host}web/index.html#!/media/{self._plex.machineIdentifier}"
f"/com.plexapp.plugins.library?source={library.key}&X-Plex-Token={self._token}",

View File

@@ -194,6 +194,7 @@ class TrimeMedia:
name=library.name,
type=library_type,
path=library.dir_list,
item_count=self.get_items_count(library.guid),
image_list=[
f"{self._api.host}{img_path}?w=256"
for img_path in library.posters or []

View File

@@ -568,6 +568,7 @@ class Ugreen:
name=lib_name,
type=library_type,
path=lib_path,
item_count=lib.get("video_count") or 0,
image_list=image_list,
link=self.__build_root_url(),
server_type="ugreen",

View File

@@ -248,6 +248,7 @@ class ZSpace:
name=library.get("Name"),
path=library.get("Path"),
type=library_type,
item_count=self.get_items_count(library.get("Id")),
image=image,
link=f'{self._playhost or self._host}web/index.html'
f'#!/videos?serverId={self.serverid}&parentId={library.get("Id")}',

View File

@@ -72,6 +72,8 @@ class MediaServerLibrary(BaseModel):
path: Optional[Union[str, list]] = None
# 类型
type: Optional[str] = None
# 媒体库内媒体数量
item_count: Optional[int] = None
# 封面图
image: Optional[str] = None
# 封面图列表