diff --git a/pkg/torznab/torznab.go b/pkg/torznab/torznab.go index f8f15fb..dd90564 100644 --- a/pkg/torznab/torznab.go +++ b/pkg/torznab/torznab.go @@ -87,6 +87,7 @@ func (r *Response) ToResults(indexer *db.TorznabInfo) []Result { Seeders: mustAtoI(item.GetAttr("seeders")), Peers: mustAtoI(item.GetAttr("peers")), Category: mustAtoI(item.GetAttr("category")), + ImdbId: item.GetAttr("imdbid"), DownloadVolumeFactor: tryParseFloat(item.GetAttr("downloadvolumefactor")), UploadVolumeFactor: tryParseFloat(item.GetAttr("uploadvolumefactor")), Source: indexer.Name, @@ -167,4 +168,5 @@ type Result struct { IndexerId int `json:"indexer_id"` Priority int `json:"priority"` IsPrivate bool `json:"is_private"` + ImdbId string `json:"imdb_id"` } diff --git a/server/core/torrent.go b/server/core/torrent.go index ec37d11..0759d13 100644 --- a/server/core/torrent.go +++ b/server/core/torrent.go @@ -67,6 +67,9 @@ func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error if !torrentSizeOk(series, r.Size, param) { continue } + if isImdbidNotMatch(series.ImdbID, r.ImdbId) { //imdb id not match + continue + } filtered = append(filtered, r) } @@ -78,6 +81,15 @@ func SearchTvSeries(db1 *db.Client, param *SearchParam) ([]torznab.Result, error } +func isImdbidNotMatch(id1, id2 string) bool { + if id1 == "" || id2 == "" { + return false + } + id1 = strings.TrimPrefix(id1, "tt") + id2 = strings.TrimPrefix(id2, "tt") + return id1 != id2 +} + func torrentSizeOk(detail *db.MediaDetails, torrentSize int, param *SearchParam) bool { if param.CheckFileSize { multiplier := 1 //大小倍数,正常为1,如果是季包则为季内集数 @@ -154,6 +166,9 @@ func SearchMovie(db1 *db.Client, param *SearchParam) ([]torznab.Result, error) { if param.FilterQiangban && meta.IsQingban { //过滤枪版电影 continue } + if isImdbidNotMatch(movieDetail.ImdbID, r.ImdbId) { //imdb id not match + continue + } ss := strings.Split(movieDetail.AirDate, "-")[0] year, _ := strconv.Atoi(ss)