Merge pull request #821 from thsrite/main

fix 从下载历史获取tmdbid入库刮削
This commit is contained in:
jxxghp 2023-10-13 15:10:33 +08:00 committed by GitHub
commit 333d187615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 12 deletions

View File

@ -263,22 +263,26 @@ class DirMonitor(_PluginBase):
target: Path = self._dirconf.get(mon_path) target: Path = self._dirconf.get(mon_path)
# 查询转移方式 # 查询转移方式
transfer_type = self._transferconf.get(mon_path) transfer_type = self._transferconf.get(mon_path)
# 根据父路径获取下载历史
download_history = self.downloadhis.get_by_path(Path(event_path).parent)
# 识别媒体信息 # 识别媒体信息
mediainfo: MediaInfo = self.chain.recognize_media(meta=file_meta) mediainfo: MediaInfo = self.chain.recognize_media(meta=file_meta,
tmdbid=download_history.tmdbid if download_history else None)
if not mediainfo: if not mediainfo:
logger.warn(f'未识别到媒体信息,标题:{file_meta.name}') logger.warn(f'未识别到媒体信息,标题:{file_meta.name}')
if self._notify:
self.chain.post_message(Notification(
mtype=NotificationType.Manual,
title=f"{file_path.name} 未识别到媒体信息,无法入库!"
))
# 新增转移成功历史记录 # 新增转移成功历史记录
self.transferhis.add_fail( his = self.transferhis.add_fail(
src_path=file_path, src_path=file_path,
mode=transfer_type, mode=transfer_type,
meta=file_meta meta=file_meta
) )
if self._notify:
self.chain.post_message(Notification(
mtype=NotificationType.Manual,
title=f"{file_path.name} 未识别到媒体信息,无法入库!\n"
f"回复:```\n/redo {his.id} [tmdbid]|[类型]\n``` 手动识别转移。"
))
return return
# 如果未开启新增已入库媒体是否跟随TMDB信息变化则根据tmdbid查询之前的title # 如果未开启新增已入库媒体是否跟随TMDB信息变化则根据tmdbid查询之前的title

View File

@ -117,7 +117,7 @@ class DownloadingMsg(_PluginBase):
if not userid: if not userid:
continue continue
# 如果用户是管理员,无需重复推送 # 如果用户是管理员,无需重复推送
if self._type == "admin" or self._type == "both" and self._adminuser and userid in str( if (self._type == "admin" or self._type == "both") and self._adminuser and userid in str(
self._adminuser).split(","): self._adminuser).split(","):
logger.debug("管理员已推送") logger.debug("管理员已推送")
continue continue
@ -177,10 +177,14 @@ class DownloadingMsg(_PluginBase):
else: else:
media_name = torrent.title media_name = torrent.title
messages.append(f"{index}. {media_name}\n" if not self._adminuser or userid not in str(self._adminuser).split(","):
f"{torrent.title} " # 下载用户发送精简消息
f"{StringUtils.str_filesize(torrent.size)} " messages.append(f"{index}. {media_name} {round(torrent.progress, 1)}%")
f"{round(torrent.progress, 1)}%") else:
messages.append(f"{index}. {media_name}\n"
f"{torrent.title} "
f"{StringUtils.str_filesize(torrent.size)} "
f"{round(torrent.progress, 1)}%")
index += 1 index += 1
# 用户消息渠道 # 用户消息渠道