feat: filter resources that is qiangban

This commit is contained in:
Simon Ding
2024-08-11 19:18:27 +08:00
parent 0057a75a95
commit 6c26812b92
8 changed files with 93 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ package server
import (
"fmt"
"polaris/db"
"polaris/ent/media"
"polaris/log"
"polaris/pkg/torznab"
@@ -77,8 +78,15 @@ func (s *Server) SearchAvailableTorrents(c *gin.Context) (interface{}, error) {
}
} else {
log.Info("search movie %d", in.ID)
qiangban := s.db.GetSetting(db.SettingAllowQiangban)
allowQiangban := false
if qiangban == "true" {
allowQiangban = true
}
res, err = core.SearchMovie(s.db, &core.SearchParam{
MediaId: in.ID,
MediaId: in.ID,
FilterQiangban: !allowQiangban,
})
if err != nil {
if err.Error() == "no resource found" {