Skip to content

Commit e72d4cc

Browse files
awordxAkimioJR
authored andcommitted
Update poster.py
1 parent 499fbb3 commit e72d4cc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

app/modules/libraryposter/poster.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ async def get_library_items(
8181
:param user_id: 用户 ID(可选)
8282
:return: 媒体库项目列表
8383
"""
84+
all_items = []
8485
if not user_id:
8586
users = await self.get_users()
8687
if not users:
@@ -96,8 +97,17 @@ async def get_library_items(
9697
f"获取 {library_id} 媒体库信息失败, 状态码: {resp.status_code if resp else '无响应'}"
9798
)
9899
return []
99-
100-
return resp.json()["Items"]
100+
for item in resp.json().get("Items", []):
101+
if item.get("IsFolder", False):
102+
# 递归获取子项
103+
url = f"{self.__server_url}/Users/{user_id}/Items?ParentId={item['Id']}&api_key={self.__api_key}"
104+
sub_items = await RequestUtils.get(url)
105+
if sub_items and sub_items.status_code == 200:
106+
all_items.extend(sub_items.json().get("Items", []))
107+
else:
108+
all_items.append(item)
109+
110+
return all_items
101111

102112
async def download_item_image(
103113
self,

0 commit comments

Comments
 (0)