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