Merge pull request #966 from thsrite/main
This commit is contained in:
commit
6415fd9286
@ -350,6 +350,7 @@ class DownloadChain(ChainBase):
|
|||||||
no_exists[_tmdbid].pop(_sea)
|
no_exists[_tmdbid].pop(_sea)
|
||||||
if not no_exists.get(_tmdbid) and no_exists.get(_tmdbid) is not None:
|
if not no_exists.get(_tmdbid) and no_exists.get(_tmdbid) is not None:
|
||||||
no_exists.pop(_tmdbid)
|
no_exists.pop(_tmdbid)
|
||||||
|
break
|
||||||
return need
|
return need
|
||||||
|
|
||||||
def __update_episodes(_tmdbid: int, _sea: int, _need: list, _current: set) -> list:
|
def __update_episodes(_tmdbid: int, _sea: int, _need: list, _current: set) -> list:
|
||||||
@ -485,8 +486,9 @@ class DownloadChain(ChainBase):
|
|||||||
need_tv = no_exists.get(need_tmdbid)
|
need_tv = no_exists.get(need_tmdbid)
|
||||||
if not need_tv:
|
if not need_tv:
|
||||||
continue
|
continue
|
||||||
|
need_tv_copy = copy.deepcopy(no_exists.get(need_tmdbid))
|
||||||
# 循环每一季
|
# 循环每一季
|
||||||
for sea, tv in need_tv.items():
|
for sea, tv in need_tv_copy.items():
|
||||||
# 当前需要季
|
# 当前需要季
|
||||||
need_season = sea
|
need_season = sea
|
||||||
# 当前需要集
|
# 当前需要集
|
||||||
|
@ -682,6 +682,25 @@ class CloudflareSpeedTest(_PluginBase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAlert',
|
||||||
|
'props': {
|
||||||
|
'text': 'F12看请求的Server属性,如果是cloudflare说明该站点支持Cloudflare IP优选。'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,26 @@ class CustomHosts(_PluginBase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAlert',
|
||||||
|
'props': {
|
||||||
|
'text': 'host格式ip host,中间有空格!!!'
|
||||||
|
'(注:容器运行则更新容器hosts!非宿主机!)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -211,7 +231,7 @@ class CustomHosts(_PluginBase):
|
|||||||
# 添加新的Hosts
|
# 添加新的Hosts
|
||||||
system_hosts.add(new_entrys)
|
system_hosts.add(new_entrys)
|
||||||
system_hosts.write()
|
system_hosts.write()
|
||||||
logger.info("更新系统hosts文件成功(注:容器运行则更新容器hosts!)")
|
logger.info("更新系统hosts文件成功")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
err_flag = True
|
err_flag = True
|
||||||
logger.error(f"更新系统hosts文件失败:{str(err) or '请检查权限'}")
|
logger.error(f"更新系统hosts文件失败:{str(err) or '请检查权限'}")
|
||||||
|
@ -264,6 +264,25 @@ class InvitesSignin(_PluginBase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAlert',
|
||||||
|
'props': {
|
||||||
|
'text': '整点定时签到失败?不妨换个时间试试'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ from app.modules.qbittorrent import Qbittorrent
|
|||||||
from app.modules.themoviedb.tmdbv3api import Episode
|
from app.modules.themoviedb.tmdbv3api import Episode
|
||||||
from app.modules.transmission import Transmission
|
from app.modules.transmission import Transmission
|
||||||
from app.plugins import _PluginBase
|
from app.plugins import _PluginBase
|
||||||
from app.schemas.types import NotificationType, EventType, MediaType
|
from app.schemas.types import NotificationType, EventType, MediaType, MediaImageType
|
||||||
|
|
||||||
|
|
||||||
class MediaSyncDel(_PluginBase):
|
class MediaSyncDel(_PluginBase):
|
||||||
@ -276,6 +276,28 @@ class MediaSyncDel(_PluginBase):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAlert',
|
||||||
|
'props': {
|
||||||
|
'text': '关于路径映射:'
|
||||||
|
'emby:/data/series/A.mp4,'
|
||||||
|
'moviepilot:/mnt/link/series/A.mp4。'
|
||||||
|
'路径映射填/data:/mnt/link'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -561,11 +583,12 @@ class MediaSyncDel(_PluginBase):
|
|||||||
logger.info(f"正在同步删除{msg}")
|
logger.info(f"正在同步删除{msg}")
|
||||||
|
|
||||||
if not transfer_history:
|
if not transfer_history:
|
||||||
logger.warn(f"{media_type} {media_name} 未获取到可删除数据,可使用媒体库刮削插件覆盖所有元数据")
|
logger.warn(
|
||||||
|
f"{media_type} {media_name} 未获取到可删除数据,请检查路径映射是否配置错误,请检查tmdbid获取是否正确")
|
||||||
return
|
return
|
||||||
|
|
||||||
# 开始删除
|
# 开始删除
|
||||||
image = 'https://emby.media/notificationicon.png'
|
image = None
|
||||||
year = None
|
year = None
|
||||||
del_torrent_hashs = []
|
del_torrent_hashs = []
|
||||||
stop_torrent_hashs = []
|
stop_torrent_hashs = []
|
||||||
@ -576,7 +599,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
logger.warn(
|
logger.warn(
|
||||||
f"当前转移记录 {transferhis.id} {title} {transferhis.tmdbid} 与删除媒体{media_name}不符,防误删,暂不自动删除")
|
f"当前转移记录 {transferhis.id} {title} {transferhis.tmdbid} 与删除媒体{media_name}不符,防误删,暂不自动删除")
|
||||||
continue
|
continue
|
||||||
image = transferhis.image
|
image = transferhis.image or image
|
||||||
year = transferhis.year
|
year = transferhis.year
|
||||||
|
|
||||||
# 0、删除转移记录
|
# 0、删除转移记录
|
||||||
@ -605,15 +628,23 @@ class MediaSyncDel(_PluginBase):
|
|||||||
|
|
||||||
logger.info(f"同步删除 {msg} 完成!")
|
logger.info(f"同步删除 {msg} 完成!")
|
||||||
|
|
||||||
|
media_type = MediaType.MOVIE if media_type in ["Movie", "MOV"] else MediaType.TV
|
||||||
|
|
||||||
# 发送消息
|
# 发送消息
|
||||||
if self._notify:
|
if self._notify:
|
||||||
if media_type == "Episode":
|
if not image or media_type == MediaType.TV:
|
||||||
# 根据tmdbid获取图片
|
specific_image = self.chain.obtain_specific_image(
|
||||||
images = self.episode.images(tv_id=tmdb_id,
|
mediaid=tmdb_id,
|
||||||
season_num=season_num,
|
mtype=media_type,
|
||||||
episode_num=episode_num)
|
image_type=MediaImageType.Backdrop,
|
||||||
if images:
|
season=season_num,
|
||||||
image = self.get_tmdbimage_url(images[-1].get("file_path"), prefix="original")
|
episode=episode_num
|
||||||
|
)
|
||||||
|
if specific_image:
|
||||||
|
image = specific_image
|
||||||
|
|
||||||
|
if not image:
|
||||||
|
image = 'https://emby.media/notificationicon.png'
|
||||||
|
|
||||||
torrent_cnt_msg = ""
|
torrent_cnt_msg = ""
|
||||||
if del_torrent_hashs:
|
if del_torrent_hashs:
|
||||||
@ -643,7 +674,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
history = self.get_data('history') or []
|
history = self.get_data('history') or []
|
||||||
|
|
||||||
history.append({
|
history.append({
|
||||||
"type": "电影" if media_type == "Movie" or media_type == "MOV" else "电视剧",
|
"type": media_type.value,
|
||||||
"title": media_name,
|
"title": media_name,
|
||||||
"year": year,
|
"year": year,
|
||||||
"path": media_path,
|
"path": media_path,
|
||||||
@ -838,7 +869,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
f"当前转移记录 {transferhis.id} {title} {transferhis.tmdbid} 与删除媒体{media_name}不符,防误删,暂不自动删除")
|
f"当前转移记录 {transferhis.id} {title} {transferhis.tmdbid} 与删除媒体{media_name}不符,防误删,暂不自动删除")
|
||||||
self.save_data("last_time", last_del_time or datetime.datetime.now())
|
self.save_data("last_time", last_del_time or datetime.datetime.now())
|
||||||
continue
|
continue
|
||||||
image = transferhis.image
|
image = transferhis.image or image
|
||||||
# 0、删除转移记录
|
# 0、删除转移记录
|
||||||
self._transferhis.delete(transferhis.id)
|
self._transferhis.delete(transferhis.id)
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import pytz
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from apscheduler.triggers.cron import CronTrigger
|
from apscheduler.triggers.cron import CronTrigger
|
||||||
|
|
||||||
@ -91,7 +92,12 @@ class MoviePilotUpdateNotify(_PluginBase):
|
|||||||
# 推送更新消息
|
# 推送更新消息
|
||||||
if self._notify:
|
if self._notify:
|
||||||
# 将时间字符串转为datetime对象
|
# 将时间字符串转为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(
|
self.post_message(
|
||||||
mtype=NotificationType.SiteMessage,
|
mtype=NotificationType.SiteMessage,
|
||||||
title="【MoviePilot更新通知】",
|
title="【MoviePilot更新通知】",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user