mirror of
https://github.com/simon-ding/polaris.git
synced 2026-03-09 19:20:46 +08:00
fix: nil
This commit is contained in:
@@ -5,7 +5,7 @@ type Torrent interface {
|
||||
Progress() int
|
||||
Stop() error
|
||||
Start() error
|
||||
Remove(deleteData bool) error
|
||||
Remove() error
|
||||
Save() string
|
||||
Exists() bool
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ func (t *Torrent) Start() error {
|
||||
return t.c.TorrentStartIDs(context.TODO(), []int64{t.ID})
|
||||
}
|
||||
|
||||
func (t *Torrent) Remove(deleteData bool) error {
|
||||
func (t *Torrent) Remove() error {
|
||||
return t.c.TorrentRemove(context.TODO(), transmissionrpc.TorrentRemovePayload{
|
||||
IDs: []int64{t.ID},
|
||||
DeleteLocalData: deleteData,
|
||||
DeleteLocalData: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
|
||||
}
|
||||
torrent := s.tasks[his.ID]
|
||||
if torrent != nil {
|
||||
if err := torrent.Remove(true); err != nil {
|
||||
if err := torrent.Remove(); err != nil {
|
||||
return nil, errors.Wrap(err, "remove torrent")
|
||||
}
|
||||
delete(s.tasks, his.ID)
|
||||
|
||||
@@ -43,8 +43,7 @@ func (s *Server) moveCompletedTask(id int) error {
|
||||
torrent := s.tasks[id]
|
||||
r := s.db.GetHistory(id)
|
||||
s.db.SetHistoryComplete(r.ID)
|
||||
tt := s.tasks[r.ID]
|
||||
tt.Remove(false)
|
||||
|
||||
delete(s.tasks, r.ID)
|
||||
|
||||
series := s.db.GetSeriesDetails(r.SeriesID)
|
||||
@@ -67,5 +66,6 @@ func (s *Server) moveCompletedTask(id int) error {
|
||||
|
||||
}
|
||||
log.Infof("move downloaded files to target dir success, file: %v, target dir: %v", torrent.Name(), r.TargetDir)
|
||||
torrent.Remove()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user