add notification link
This commit is contained in:
@ -89,7 +89,8 @@ class DownloadChain(ChainBase):
|
||||
title=f"{mediainfo.title_year} "
|
||||
f"{'%s %s' % (meta.season, download_episodes) if download_episodes else meta.season_episode} 开始下载",
|
||||
text=msg_text,
|
||||
image=mediainfo.get_message_image()))
|
||||
image=mediainfo.get_message_image(),
|
||||
link=settings.MP_DOMAIN('/#/downloading')))
|
||||
|
||||
def download_torrent(self, torrent: TorrentInfo,
|
||||
channel: MessageChannel = None,
|
||||
@ -841,7 +842,9 @@ class DownloadChain(ChainBase):
|
||||
channel=channel,
|
||||
mtype=NotificationType.Download,
|
||||
title="没有正在下载的任务!",
|
||||
userid=userid))
|
||||
userid=userid,
|
||||
link=settings.MP_DOMAIN('#/downloading')
|
||||
))
|
||||
return
|
||||
# 发送消息
|
||||
title = f"共 {len(torrents)} 个任务正在下载:"
|
||||
@ -853,8 +856,13 @@ class DownloadChain(ChainBase):
|
||||
f"{round(torrent.progress, 1)}%")
|
||||
index += 1
|
||||
self.post_message(Notification(
|
||||
channel=channel, mtype=NotificationType.Download,
|
||||
title=title, text="\n".join(messages), userid=userid))
|
||||
channel=channel,
|
||||
mtype=NotificationType.Download,
|
||||
title=title,
|
||||
text="\n".join(messages),
|
||||
userid=userid,
|
||||
link=settings.MP_DOMAIN('#/downloading')
|
||||
))
|
||||
|
||||
def downloading(self) -> List[DownloadingTorrent]:
|
||||
"""
|
||||
|
@ -520,5 +520,6 @@ class MessageChain(ChainBase):
|
||||
self.post_torrents_message(Notification(
|
||||
channel=channel,
|
||||
title=title,
|
||||
userid=userid
|
||||
userid=userid,
|
||||
link=settings.MP_DOMAIN('#/resource')
|
||||
), torrents=items)
|
||||
|
@ -109,11 +109,11 @@ class SiteChain(ChainBase):
|
||||
user_agent = site.ua or settings.USER_AGENT
|
||||
url = f"{site.url}api/member/profile"
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": user_agent,
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Authorization": site.token
|
||||
}
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": user_agent,
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Authorization": site.token
|
||||
}
|
||||
res = RequestUtils(
|
||||
headers=headers,
|
||||
proxies=settings.PROXY if site.proxy else None,
|
||||
@ -457,7 +457,8 @@ class SiteChain(ChainBase):
|
||||
self.post_message(Notification(
|
||||
channel=channel,
|
||||
title="没有维护任何站点信息!",
|
||||
userid=userid))
|
||||
userid=userid,
|
||||
link=settings.MP_DOMAIN('#/site')))
|
||||
title = f"共有 {len(site_list)} 个站点,回复对应指令操作:" \
|
||||
f"\n- 禁用站点:/site_disable [id]" \
|
||||
f"\n- 启用站点:/site_enable [id]" \
|
||||
@ -475,7 +476,8 @@ class SiteChain(ChainBase):
|
||||
# 发送列表
|
||||
self.post_message(Notification(
|
||||
channel=channel,
|
||||
title=title, text="\n".join(messages), userid=userid))
|
||||
title=title, text="\n".join(messages), userid=userid,
|
||||
link=settings.MP_DOMAIN('#/site')))
|
||||
|
||||
def remote_disable(self, arg_str, channel: MessageChannel, userid: Union[str, int] = None):
|
||||
"""
|
||||
|
@ -169,10 +169,15 @@ class SubscribeChain(ChainBase):
|
||||
else:
|
||||
text = f"评分:{mediainfo.vote_average}"
|
||||
# 群发
|
||||
if mediainfo.type == MediaType.TV:
|
||||
link = settings.MP_DOMAIN('#/subscribe-tv?tab=mysub')
|
||||
else:
|
||||
link = settings.MP_DOMAIN('#/subscribe-movie?tab=mysub')
|
||||
self.post_message(Notification(mtype=NotificationType.Subscribe,
|
||||
title=f"{mediainfo.title_year} {metainfo.season} 已添加订阅",
|
||||
text=text,
|
||||
image=mediainfo.get_message_image()))
|
||||
image=mediainfo.get_message_image(),
|
||||
link=link))
|
||||
# 发送事件
|
||||
EventManager().send_event(EventType.SubscribeAdded, {
|
||||
"subscribe_id": sid,
|
||||
@ -922,9 +927,14 @@ class SubscribeChain(ChainBase):
|
||||
# 删除订阅
|
||||
self.subscribeoper.delete(subscribe.id)
|
||||
# 发送通知
|
||||
if mediainfo.type == MediaType.TV:
|
||||
link = settings.MP_DOMAIN('#/subscribe-tv?tab=mysub')
|
||||
else:
|
||||
link = settings.MP_DOMAIN('#/subscribe-movie?tab=mysub')
|
||||
self.post_message(Notification(mtype=NotificationType.Subscribe,
|
||||
title=f'{mediainfo.title_year} {meta.season} 已完成{msgstr}',
|
||||
image=mediainfo.get_message_image()))
|
||||
image=mediainfo.get_message_image(),
|
||||
link=link))
|
||||
# 发送事件
|
||||
EventManager().send_event(EventType.SubscribeComplete, {
|
||||
"subscribe_id": subscribe.id,
|
||||
|
@ -99,7 +99,8 @@ class TorrentsChain(ChainBase, metaclass=Singleton):
|
||||
if not site.get("rss"):
|
||||
logger.error(f'站点 {domain} 未配置RSS地址!')
|
||||
return []
|
||||
rss_items = self.rsshelper.parse(site.get("rss"), True if site.get("proxy") else False, timeout=int(site.get("timeout") or 30))
|
||||
rss_items = self.rsshelper.parse(site.get("rss"), True if site.get("proxy") else False,
|
||||
timeout=int(site.get("timeout") or 30))
|
||||
if rss_items is None:
|
||||
# rss过期,尝试保留原配置生成新的rss
|
||||
self.__renew_rss_url(domain=domain, site=site)
|
||||
@ -253,10 +254,14 @@ class TorrentsChain(ChainBase, metaclass=Singleton):
|
||||
else:
|
||||
# 发送消息
|
||||
self.post_message(
|
||||
Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期"))
|
||||
Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期",
|
||||
link=settings.MP_DOMAIN('#/site'))
|
||||
)
|
||||
else:
|
||||
self.post_message(
|
||||
Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期"))
|
||||
Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期",
|
||||
link=settings.MP_DOMAIN('#/site')))
|
||||
except Exception as e:
|
||||
logger.error(f"站点 {domain} RSS链接自动获取失败:{str(e)} - {traceback.format_exc()}")
|
||||
self.post_message(Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期"))
|
||||
self.post_message(Notification(mtype=NotificationType.SiteMessage, title=f"站点 {domain} RSS链接已过期",
|
||||
link=settings.MP_DOMAIN('#/site')))
|
||||
|
@ -269,7 +269,8 @@ class TransferChain(ChainBase):
|
||||
self.post_message(Notification(
|
||||
mtype=NotificationType.Manual,
|
||||
title=f"{file_path.name} 未识别到媒体信息,无法入库!",
|
||||
text=f"回复:```\n/redo {his.id} [tmdbid]|[类型]\n``` 手动识别转移。"
|
||||
text=f"回复:```\n/redo {his.id} [tmdbid]|[类型]\n``` 手动识别转移。",
|
||||
link=settings.MP_DOMAIN('#/history')
|
||||
))
|
||||
# 计数
|
||||
processed_num += 1
|
||||
@ -332,7 +333,8 @@ class TransferChain(ChainBase):
|
||||
mtype=NotificationType.Manual,
|
||||
title=f"{file_mediainfo.title_year} {file_meta.season_episode} 入库失败!",
|
||||
text=f"原因:{transferinfo.message or '未知'}",
|
||||
image=file_mediainfo.get_message_image()
|
||||
image=file_mediainfo.get_message_image(),
|
||||
link=settings.MP_DOMAIN('#/history')
|
||||
))
|
||||
# 计数
|
||||
processed_num += 1
|
||||
@ -506,7 +508,7 @@ class TransferChain(ChainBase):
|
||||
mediaid=media_id)
|
||||
if not state:
|
||||
self.post_message(Notification(channel=channel, title="手动整理失败",
|
||||
text=errmsg, userid=userid))
|
||||
text=errmsg, userid=userid, link=settings.MP_DOMAIN('#/history')))
|
||||
return
|
||||
|
||||
def re_transfer(self, logid: int, mtype: MediaType = None,
|
||||
@ -642,7 +644,8 @@ class TransferChain(ChainBase):
|
||||
# 发送
|
||||
self.post_message(Notification(
|
||||
mtype=NotificationType.Organize,
|
||||
title=msg_title, text=msg_str, image=mediainfo.get_message_image()))
|
||||
title=msg_title, text=msg_str, image=mediainfo.get_message_image(),
|
||||
link=settings.MP_DOMAIN('#/history')))
|
||||
|
||||
def delete_files(self, path: Path) -> Tuple[bool, str]:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user