fix: name cannot parsed

This commit is contained in:
Simon Ding
2024-07-24 18:35:01 +08:00
parent f4b8d03cfc
commit 16ca00d19c
6 changed files with 22 additions and 19 deletions

View File

@@ -31,8 +31,11 @@ func SearchEpisode(db1 *db.Client, seriesId, seasonNum, episodeNum int, checkRes
var filtered []torznab.Result
for _, r := range res {
log.Infof("torrent resource: %+v", r)
//log.Infof("torrent resource: %+v", r)
meta := metadata.ParseTv(r.Name)
if meta == nil { //cannot parse name
continue
}
if meta.Season != seasonNum {
continue
}

View File

@@ -89,7 +89,7 @@ func (s *Server) searchAndDownloadSeasonPackage(seriesId, seasonNum int) (*strin
return nil, errors.New("no enough space")
}
torrent, err := trc.Download(r1.Magnet, s.db.GetDownloadDir())
torrent, err := trc.Download(r1.Link, s.db.GetDownloadDir())
if err != nil {
return nil, errors.Wrap(err, "downloading")
}
@@ -144,7 +144,7 @@ func (s *Server) searchAndDownload(seriesId, seasonNum, episodeNum int) (*string
}
r1 := res[0]
log.Infof("found resource to download: %+v", r1)
torrent, err := trc.Download(r1.Magnet, s.db.GetDownloadDir())
torrent, err := trc.Download(r1.Link, s.db.GetDownloadDir())
if err != nil {
return nil, errors.Wrap(err, "downloading")
}
@@ -195,7 +195,7 @@ func (s *Server) SearchAvailableEpisodeResource(c *gin.Context) (interface{}, er
Size: r.Size,
Seeders: r.Seeders,
Peers: r.Peers,
Link: r.Magnet,
Link: r.Link,
})
}
if len(searchResults) == 0 {
@@ -268,7 +268,7 @@ func (s *Server) SearchAvailableMovies(c *gin.Context) (interface{}, error) {
Size: r.Size,
Seeders: r.Seeders,
Peers: r.Peers,
Link: r.Magnet,
Link: r.Link,
})
}
if len(searchResults) == 0 {

View File

@@ -294,7 +294,7 @@ func (s *Server) downloadMovieSingleEpisode(ep *ent.Episode) error {
}
r1 := res[0]
log.Infof("begin download torrent resource: %v", r1.Name)
torrent, err := trc.Download(r1.Magnet, s.db.GetDownloadDir())
torrent, err := trc.Download(r1.Link, s.db.GetDownloadDir())
if err != nil {
return errors.Wrap(err, "downloading")
}