Skip to content

Commit

Permalink
fix #2526 Backdrop优先调整为取art
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityPacer committed Jul 7, 2024
1 parent 41e2907 commit f102119
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/modules/plex/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,26 +288,26 @@ def get_remote_image_by_id(self, item_id: str, image_type: str, depth: int = 0)
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
Expand Down
1 change: 1 addition & 0 deletions app/utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def combine_url(host: str, path: Optional[str] = None, query: Optional[dict] = N
# 如果路径为空,则默认为 '/'
if path is None:
path = '/'
host = RequestUtils.standardize_base_url(host)
# 使用 urljoin 合并 host 和 path
url = urljoin(host, path)
# 解析当前 URL 的组成部分
Expand Down

0 comments on commit f102119

Please sign in to comment.