Infinite repair fix
This commit is contained in:
@@ -146,6 +146,11 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
t.log.Infof("repair_method#1: Torrent %s is still in progress but it should work once done (torrent is temporarily hidden until download has completed)", t.GetKey(torrent))
|
||||
return
|
||||
} else if info != nil && info.IsDone() && !t.isStillBroken(info, brokenFiles) {
|
||||
ix := 0
|
||||
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
file.Link = info.Links[ix]
|
||||
ix++
|
||||
})
|
||||
t.log.Infof("Successfully repaired torrent %s using repair_method#1", t.GetKey(torrent))
|
||||
return
|
||||
}
|
||||
@@ -487,13 +492,23 @@ func (t *TorrentManager) handleFixers(fixer realdebrid.Torrent) *Torrent {
|
||||
}
|
||||
|
||||
if info.IsDone() {
|
||||
if t.isStillBroken(info, brokenFiles) {
|
||||
if !t.isStillBroken(info, brokenFiles) {
|
||||
ix := 0
|
||||
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
for _, brokenFile := range brokenFiles {
|
||||
if file.ID == brokenFile.ID {
|
||||
file.Link = info.Links[ix]
|
||||
ix++
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
t.log.Infof("Successfully repaired torrent %s using repair_method#2", t.GetKey(torrent))
|
||||
} else {
|
||||
t.log.Warnf("repair_method#2: Fixer is done but torrent %s is still broken; let's keep the fixer", t.GetKey(torrent))
|
||||
t.Api.DeleteTorrent(info.ID)
|
||||
t.deleteOnceDone.Add(fixer.ID)
|
||||
return t.getMoreInfo(fixer)
|
||||
} else {
|
||||
t.log.Infof("Successfully repaired torrent %s using repair_method#2", t.GetKey(torrent))
|
||||
}
|
||||
} else {
|
||||
t.log.Infof("repair_method#2: Torrent %s is still in progress but it should work once done (torrent is temporarily hidden until download has completed)", t.GetKey(torrent))
|
||||
|
||||
Reference in New Issue
Block a user