mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 17:08:35 +08:00
feat(Plex): 增加从Plex获取图片的URL选项,支持选择返回Plex URL还是TMDB URL
This commit is contained in:
@@ -293,13 +293,18 @@ class Plex:
|
|||||||
season_episodes[episode.seasonNumber].append(episode.index)
|
season_episodes[episode.seasonNumber].append(episode.index)
|
||||||
return videos.key, season_episodes
|
return videos.key, season_episodes
|
||||||
|
|
||||||
def get_remote_image_by_id(self, item_id: str, image_type: str, depth: int = 0) -> Optional[str]:
|
def get_remote_image_by_id(self,
|
||||||
|
item_id: str,
|
||||||
|
image_type: str,
|
||||||
|
depth: int = 0,
|
||||||
|
plex_url: bool = True) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
根据ItemId从Plex查询图片地址
|
根据ItemId从Plex查询图片地址
|
||||||
:param item_id: 在Plex中的ID
|
:param item_id: 在Plex中的ID
|
||||||
:param image_type: 图片的类型,Poster或者Backdrop等
|
:param image_type: 图片的类型,Poster或者Backdrop等
|
||||||
:param depth: 当前递归深度,默认为0
|
:param depth: 当前递归深度,默认为0
|
||||||
:return: 图片对应在TMDB中的URL
|
:param plex_url: 是否返回Plex的URL,默认为True(仅在配置了外网地址和Token时有效)
|
||||||
|
:return: 图片对应在plex服务器或TMDB中的URL
|
||||||
"""
|
"""
|
||||||
if not self._plex or depth > 2 or not item_id:
|
if not self._plex or depth > 2 or not item_id:
|
||||||
return None
|
return None
|
||||||
@@ -310,7 +315,7 @@ class Plex:
|
|||||||
if not item:
|
if not item:
|
||||||
return None
|
return None
|
||||||
# 如果配置了外网播放地址以及Token,则默认从Plex媒体服务器获取图片,否则返回有外网地址的图片资源
|
# 如果配置了外网播放地址以及Token,则默认从Plex媒体服务器获取图片,否则返回有外网地址的图片资源
|
||||||
if self._playhost and self._token:
|
if self._playhost and self._token and plex_url:
|
||||||
query = {"X-Plex-Token": self._token}
|
query = {"X-Plex-Token": self._token}
|
||||||
if image_type == "Poster":
|
if image_type == "Poster":
|
||||||
if item.thumb:
|
if item.thumb:
|
||||||
|
|||||||
Reference in New Issue
Block a user