From 10315c8269f5708285a1f4c70c38a2fcc3da423a Mon Sep 17 00:00:00 2001 From: mayun110 Date: Tue, 15 Aug 2023 12:01:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=E6=97=A5=E5=BF=97=20=E5=9C=A8windows?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/endpoints/system.py b/app/api/endpoints/system.py index 4272ee51..93480b8e 100644 --- a/app/api/endpoints/system.py +++ b/app/api/endpoints/system.py @@ -112,11 +112,11 @@ def get_logging(token: str): def log_generator(): log_path = settings.LOG_PATH / 'moviepilot.log' # 读取文件末尾50行,不使用tailer模块 - with open(log_path, 'r') as f: + with open(log_path, 'r', encoding='utf-8') as f: for line in f.readlines()[-50:]: yield 'data: %s\n\n' % line while True: - for text in tailer.follow(open(log_path, 'r')): + for text in tailer.follow(open(log_path, 'r', encoding='utf-8')): yield 'data: %s\n\n' % (text or '') time.sleep(1) From 93fca22c64f5c2e0bd79fd94448bf9520f54cf72 Mon Sep 17 00:00:00 2001 From: mayun110 Date: Tue, 15 Aug 2023 12:04:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=20#120=20Plex=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/plex/plex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index b04c968f..036cfb04 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -159,7 +159,7 @@ class Plex(metaclass=Singleton): videos = self._plex.library.search(title=title, year=year, libtype="show") if not videos: return {} - episodes = videos[0].episodes() + episodes = videos.episodes() season_episodes = {} for episode in episodes: if season and episode.seasonNumber != int(season): From 102e48106e1a04badf76a85547d4bc98759fada8 Mon Sep 17 00:00:00 2001 From: mayun110 Date: Tue, 15 Aug 2023 14:05:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=20#120=20Plex=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/plex/plex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index 036cfb04..a0b56317 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -159,7 +159,10 @@ class Plex(metaclass=Singleton): videos = self._plex.library.search(title=title, year=year, libtype="show") if not videos: return {} - episodes = videos.episodes() + if isinstance(videos, list): + episodes = videos[0].episodes() + else: + episodes = videos.episodes() season_episodes = {} for episode in episodes: if season and episode.seasonNumber != int(season):