mirror of
https://github.com/simon-ding/polaris.git
synced 2026-04-21 03:07:30 +08:00
feat: start download after save to db
This commit is contained in:
@@ -38,12 +38,6 @@ func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum i
|
||||
return nil, errors.Errorf("converting link to magnet error, link: %v, error: %v", r1.Link, err)
|
||||
}
|
||||
|
||||
torrent, err := trc.Download(magnet, downloadDir)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "downloading")
|
||||
}
|
||||
torrent.Start()
|
||||
|
||||
dir := fmt.Sprintf("%s/Season %02d/", series.TargetDir, seasonNum)
|
||||
|
||||
if len(episodeNums) > 0 {
|
||||
@@ -84,6 +78,12 @@ func (c *Client) DownloadEpisodeTorrent(r1 torznab.Result, seriesId, seasonNum i
|
||||
return nil, errors.Wrap(err, "save record")
|
||||
}
|
||||
|
||||
torrent, err := trc.Download(magnet, downloadDir)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "downloading")
|
||||
}
|
||||
torrent.Start()
|
||||
|
||||
c.tasks[history.ID] = &Task{Torrent: torrent}
|
||||
name := r1.Name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user