Merge branch 'jxxghp:main' into main

This commit is contained in:
thsrite
2023-08-07 11:44:44 +08:00
committed by GitHub
12 changed files with 343 additions and 113 deletions

View File

@ -13,9 +13,10 @@ from app.core.event import eventmanager, Event
from app.db.models.transferhistory import TransferHistory
from app.db.transferhistory_oper import TransferHistoryOper
from app.log import logger
from app.modules.emby import Emby
from app.modules.jellyfin import Jellyfin
from app.plugins import _PluginBase
from app.schemas.types import NotificationType, EventType
from app.utils.http import RequestUtils
class MediaSyncDel(_PluginBase):
@ -469,18 +470,8 @@ class MediaSyncDel(_PluginBase):
@staticmethod
def parse_emby_log(last_time):
# emby host
emby_host = settings.EMBY_HOST
if emby_host:
if not emby_host.endswith("/"):
emby_host += "/"
if not emby_host.startswith("http"):
emby_host = "http://" + emby_host
# emby 日志url
log_url = "%sSystem/Logs/embyserver.txt?api_key=%s" % (emby_host, settings.EMBY_API_KEY)
log_res = RequestUtils().get_res(url=log_url)
log_url = "{HOST}System/Logs/embyserver.txt?api_key={APIKEY}"
log_res = Emby().get_data(log_url)
if not log_res or log_res.status_code != 200:
logger.error("获取emby日志失败请检查服务器配置")
return []
@ -551,19 +542,9 @@ class MediaSyncDel(_PluginBase):
@staticmethod
def parse_jellyfin_log(last_time):
# jellyfin host
jellyfin_host = settings.JELLYFIN_HOST
if jellyfin_host:
if not jellyfin_host.endswith("/"):
jellyfin_host += "/"
if not jellyfin_host.startswith("http"):
jellyfin_host = "http://" + jellyfin_host
# jellyfin 日志url
log_url = "%sSystem/Logs/Log?name=log_%s.log&api_key=%s" % (
jellyfin_host, datetime.date.today().strftime("%Y%m%d"), settings.JELLYFIN_API_KEY)
log_res = RequestUtils().get_res(url=log_url)
# 根据加入日期 降序排序
log_url = "{HOST}System/Logs/Log?name=log_%s.log&api_key={APIKEY}" % datetime.date.today().strftime("%Y%m%d")
log_res = Jellyfin().get_data(log_url)
if not log_res or log_res.status_code != 200:
logger.error("获取jellyfin日志失败请检查服务器配置")
return []