From 089d4785aa9402c5a0e28d6b4c61d366f909ec1d Mon Sep 17 00:00:00 2001 From: zhu0823 Date: Mon, 6 May 2024 18:35:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20plex=E6=9C=80=E8=BF=91=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9A=84=E5=89=A7=E9=9B=86=E5=B0=81=E9=9D=A2=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/plex/plex.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index eab1eb03..14a8e558 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import List, Optional, Dict, Tuple, Generator, Any from urllib.parse import quote_plus -from plexapi import media, utils +from plexapi import media from plexapi.server import PlexServer from app import schemas @@ -679,19 +679,20 @@ class Plex: for item in sub_result: if len(ret_resume) >= num: break - item_type = "" - title = "" + item_type, title, image = "", "", "" if item.TYPE == "movie": item_type = MediaType.MOVIE.value title = item.title + image = item.posterUrl elif item.TYPE == "season": item_type = MediaType.TV.value title = "%s 第%s季" % (item.parentTitle, item.index) + image = item.posterUrl elif item.TYPE == "episode": item_type = MediaType.TV.value title = "%s 第%s季 第%s集" % (item.grandparentTitle, item.parentIndex, item.index) - link = self.get_play_url(item.key).rstrip('/children') - image = item.posterUrl + image = self._host + item.parentThumb.lstrip('/') + f"?X-Plex-Token={self._token}" + link = self.get_play_url(item.key) ret_resume.append(schemas.MediaServerPlayItem( id=item.key, title=title,