From 2dd4395698c44e7597e43d3b28d93194a449e152 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 26 Oct 2023 11:28:07 +0800 Subject: [PATCH] fix #935 --- app/plugins/moviepilotupdatenotify/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/plugins/moviepilotupdatenotify/__init__.py b/app/plugins/moviepilotupdatenotify/__init__.py index b2cb81cd..76bb631d 100644 --- a/app/plugins/moviepilotupdatenotify/__init__.py +++ b/app/plugins/moviepilotupdatenotify/__init__.py @@ -1,5 +1,6 @@ import datetime +import pytz from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.cron import CronTrigger @@ -91,7 +92,12 @@ class MoviePilotUpdateNotify(_PluginBase): # 推送更新消息 if self._notify: # 将时间字符串转为datetime对象 - update_time = datetime.datetime.strptime(update_time, "%Y-%m-%dT%H:%M:%SZ").strftime("%Y-%m-%d %H:%M:%S") + dt = datetime.datetime.strptime(update_time, "%Y-%m-%dT%H:%M:%SZ") + # 设置时区 + timezone = pytz.timezone(settings.TZ) + dt = dt.replace(tzinfo=timezone) + # 将datetime对象转换为带时区的字符串 + update_time = dt.strftime("%Y-%m-%d %H:%M:%S") self.post_message( mtype=NotificationType.SiteMessage, title="【MoviePilot更新通知】",