From f102119eefb01f26bb1e68f478cd58555ff11c4d Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:03:34 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#2526=20Backdrop=E4=BC=98=E5=85=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BA=E5=8F=96art?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/plex/plex.py | 20 ++++++++++---------- app/utils/http.py | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index 8b2f17eb..1ed03df2 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -288,26 +288,26 @@ class Plex: if item.thumb: image_url = RequestUtils.combine_url(host=settings.PLEX_PLAY_HOST, path=item.thumb, query=query) else: - # 这里对episode进行特殊处理,实际上episode的Backdrop是Poster - if item.TYPE == "episode" and item.thumb: - image_url = RequestUtils.combine_url(host=settings.PLEX_PLAY_HOST, path=item.thumb, query=query) # 默认使用art也就是Backdrop进行处理 - if not image_url and item.art: + if item.art: image_url = RequestUtils.combine_url(host=settings.PLEX_PLAY_HOST, path=item.art, query=query) + # 这里对episode进行特殊处理,实际上episode的Backdrop是Poster + # 也有个别情况,比如机智的凡人小子episode就是Poster,因此这里把episode的优先级降低,默认还是取art + if not image_url and item.TYPE == "episode" and item.thumb: + image_url = RequestUtils.combine_url(host=settings.PLEX_PLAY_HOST, path=item.thumb, query=query) else: if image_type == "Poster": images = self._plex.fetchItems(ekey=f"{ekey}/posters", cls=media.Poster) else: + # 默认使用art也就是Backdrop进行处理 + images = self._plex.fetchItems(ekey=f"{ekey}/arts", + cls=media.Art) # 这里对episode进行特殊处理,实际上episode的Backdrop是Poster - images = None - if item.TYPE == "episode": + # 也有个别情况,比如机智的凡人小子episode就是Poster,因此这里把episode的优先级降低,默认还是取art + if not images and item.TYPE == "episode": images = self._plex.fetchItems(ekey=f"{ekey}/posters", cls=media.Poster) - # 默认使用art也就是Backdrop进行处理 - if not images: - images = self._plex.fetchItems(ekey=f"{ekey}/arts", - cls=media.Art) for image in images: if hasattr(image, "key") and image.key.startswith("http"): image_url = image.key diff --git a/app/utils/http.py b/app/utils/http.py index b2512cd5..bdef4272 100644 --- a/app/utils/http.py +++ b/app/utils/http.py @@ -269,6 +269,7 @@ class RequestUtils: # 如果路径为空,则默认为 '/' if path is None: path = '/' + host = RequestUtils.standardize_base_url(host) # 使用 urljoin 合并 host 和 path url = urljoin(host, path) # 解析当前 URL 的组成部分