diff --git a/internal/service/downloads.go b/internal/service/downloads.go index ade9197..b0ea9f2 100644 --- a/internal/service/downloads.go +++ b/internal/service/downloads.go @@ -1357,6 +1357,11 @@ func (d *DownloadService) notifyDownloadComplete(ctx context.Context, torrent QB } body := fmt.Sprintf("任务:%s\n保存路径:%s\nHash:%s", name, firstNonEmpty(torrent.ContentPath, torrent.SavePath), torrent.Hash) data := map[string]interface{}{} + // resource_title 供 Telegram 模板从发布名提取季集(SxxEyy)与版本(分辨率/编码/ + // 字幕组等)信息;隐藏不直接展示。优先用 torrent 原始名(信息最全)。 + if rt := strings.TrimSpace(torrent.Name); rt != "" { + data["resource_title"] = rt + } if task != nil { if strings.TrimSpace(task.PosterURL) != "" { data["poster_url"] = task.PosterURL @@ -1370,6 +1375,12 @@ func (d *DownloadService) notifyDownloadComplete(ctx context.Context, torrent QB if strings.TrimSpace(task.MediaCategory) != "" { data["media_category"] = task.MediaCategory } + if strings.TrimSpace(task.Title) != "" { + data["title"] = task.Title + } + if strings.TrimSpace(task.Overview) != "" { + data["overview"] = task.Overview + } } go func() { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) diff --git a/internal/service/subscription.go b/internal/service/subscription.go index ca69843..4878aa9 100644 --- a/internal/service/subscription.go +++ b/internal/service/subscription.go @@ -469,6 +469,20 @@ func (s *SubscriptionService) notifySubscriptionHit(sub *model.Subscription, que if strings.TrimSpace(sub.MediaCategory) != "" { data["media_category"] = sub.MediaCategory } + // 补充媒体通知模板(formatTelegramMediaNotification)所需字段:片名 / 简介 / + // 外链 / 资源标题(供模板提取季集 + 版本)。仅填现成可用的,缺失项模板会自动略过。 + if strings.TrimSpace(sub.Name) != "" { + data["title"] = sub.Name + } + if strings.TrimSpace(sub.Overview) != "" { + data["overview"] = sub.Overview + } + if id := strings.TrimSpace(sub.IMDBID); id != "" { + data["imdb_url"] = "https://www.imdb.com/title/" + id + "/" + } + if len(resources) > 0 { + data["resource_title"] = resources[0] + } s.notify.BroadcastEvent(ctx, NotifyEvent{ Type: EventSubscriptionHit, Title: "MediaStationGo 订阅命中新资源",