feat: block torrent in blacklist from addng to download client

This commit is contained in:
Simon Ding
2025-04-23 10:26:13 +08:00
parent 0d527c22e5
commit 9e41a1513c
4 changed files with 74 additions and 23 deletions

View File

@@ -28,7 +28,10 @@ func (s *Server) searchAndDownloadSeasonPackage(seriesId, seasonNum int) (*strin
r1 := res[0]
log.Infof("found resource to download: %+v", r1)
return s.core.DownloadEpisodeTorrent(r1, seriesId, seasonNum)
return s.core.DownloadEpisodeTorrent(r1, engine.DownloadOptions{
SeasonNum: seasonNum,
MediaId: seriesId,
})
}
@@ -154,14 +157,21 @@ func (s *Server) DownloadTorrent(c *gin.Context) (interface{}, error) {
name = fmt.Sprintf("%v S%02d", m.OriginalName, in.Season)
}
res := torznab.Result{Name: name, Link: in.Link, Size: in.Size}
return s.core.DownloadEpisodeTorrent(res, in.MediaID, in.Season)
return s.core.DownloadEpisodeTorrent(res, engine.DownloadOptions{
SeasonNum: in.Season,
MediaId: in.MediaID,
})
}
name := in.Name
if name == "" {
name = fmt.Sprintf("%v S%02dE%02d", m.OriginalName, in.Season, in.Episode)
}
res := torznab.Result{Name: name, Link: in.Link, Size: in.Size, IndexerId: in.IndexerId}
return s.core.DownloadEpisodeTorrent(res, in.MediaID, in.Season, in.Episode)
return s.core.DownloadEpisodeTorrent(res, engine.DownloadOptions{
SeasonNum: in.Season,
MediaId: in.MediaID,
EpisodeNums: []int{in.Episode},
})
} else {
//movie
name := in.Name