fix images

This commit is contained in:
thsrite 2023-10-26 15:07:39 +08:00
parent 7130194d5f
commit 27ba8db4ea
2 changed files with 29 additions and 21 deletions

View File

@ -106,13 +106,13 @@ class CloudDiskDel(_PluginBase):
image = 'https://emby.media/notificationicon.png' image = 'https://emby.media/notificationicon.png'
media_type = MediaType.MOVIE if media_type in ["Movie", "MOV"] else MediaType.TV media_type = MediaType.MOVIE if media_type in ["Movie", "MOV"] else MediaType.TV
if self._notify: if self._notify:
poster_image = self.chain.obtain_specific_image( backrop_image = self.chain.obtain_specific_image(
mediaid=tmdb_id, mediaid=tmdb_id,
mtype=media_type, mtype=media_type,
image_type=MediaImageType.Poster, image_type=MediaImageType.Backdrop,
) season=season_num,
if poster_image: episode=episode_num
image = poster_image ) or image
# 类型 # 类型
if media_type == MediaType.MOVIE: if media_type == MediaType.MOVIE:
@ -133,7 +133,7 @@ class CloudDiskDel(_PluginBase):
self.post_message( self.post_message(
mtype=NotificationType.MediaServer, mtype=NotificationType.MediaServer,
title="云盘同步删除任务完成", title="云盘同步删除任务完成",
image=image, image=backrop_image,
text=f"{msg}\n" text=f"{msg}\n"
f"时间 {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}" f"时间 {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}"
) )
@ -141,13 +141,19 @@ class CloudDiskDel(_PluginBase):
# 读取历史记录 # 读取历史记录
history = self.get_data('history') or [] history = self.get_data('history') or []
# 获取poster
poster_image = self.chain.obtain_specific_image(
mediaid=tmdb_id,
mtype=media_type,
image_type=MediaImageType.Poster,
) or image
history.append({ history.append({
"type": media_type.value, "type": media_type.value,
"title": media_name, "title": media_name,
"path": media_path, "path": media_path,
"season": season_num, "season": season_num,
"episode": episode_num, "episode": episode_num,
"image": image, "image": poster_image,
"del_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) "del_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
}) })

View File

@ -617,11 +617,11 @@ class MediaSyncDel(_PluginBase):
return return
# 开始删除 # 开始删除
image = None
year = None year = None
del_torrent_hashs = [] del_torrent_hashs = []
stop_torrent_hashs = [] stop_torrent_hashs = []
error_cnt = 0 error_cnt = 0
image = 'https://emby.media/notificationicon.png'
for transferhis in transfer_history: for transferhis in transfer_history:
title = transferhis.title title = transferhis.title
if title not in media_name: if title not in media_name:
@ -661,17 +661,13 @@ class MediaSyncDel(_PluginBase):
# 发送消息 # 发送消息
if self._notify: if self._notify:
if not image or media_type == MediaType.TV: backrop_image = self.chain.obtain_specific_image(
poster_image = self.chain.obtain_specific_image( mediaid=tmdb_id,
mediaid=tmdb_id, mtype=media_type,
mtype=media_type, image_type=MediaImageType.Backdrop,
image_type=MediaImageType.Poster, season=season_num,
) episode=episode_num
if poster_image: ) or image
image = poster_image
if not image:
image = 'https://emby.media/notificationicon.png'
torrent_cnt_msg = "" torrent_cnt_msg = ""
if del_torrent_hashs: if del_torrent_hashs:
@ -690,7 +686,7 @@ class MediaSyncDel(_PluginBase):
self.post_message( self.post_message(
mtype=NotificationType.MediaServer, mtype=NotificationType.MediaServer,
title="媒体库同步删除任务完成", title="媒体库同步删除任务完成",
image=image, image=backrop_image,
text=f"{msg}\n" text=f"{msg}\n"
f"删除记录{len(transfer_history)}\n" f"删除记录{len(transfer_history)}\n"
f"{torrent_cnt_msg}" f"{torrent_cnt_msg}"
@ -700,6 +696,12 @@ class MediaSyncDel(_PluginBase):
# 读取历史记录 # 读取历史记录
history = self.get_data('history') or [] history = self.get_data('history') or []
# 获取poster
poster_image = self.chain.obtain_specific_image(
mediaid=tmdb_id,
mtype=media_type,
image_type=MediaImageType.Poster,
) or image
history.append({ history.append({
"type": media_type.value, "type": media_type.value,
"title": media_name, "title": media_name,
@ -707,7 +709,7 @@ class MediaSyncDel(_PluginBase):
"path": media_path, "path": media_path,
"season": season_num, "season": season_num,
"episode": episode_num, "episode": episode_num,
"image": image, "image": poster_image,
"del_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) "del_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
}) })