quick repair bug fix
This commit is contained in:
@@ -520,18 +520,24 @@ func (t *TorrentManager) repair(torrentID string, selectedFiles []File, tryReins
|
|||||||
// or if there's only 1 missing file, we will download 1 more to prevent a rename
|
// or if there's only 1 missing file, we will download 1 more to prevent a rename
|
||||||
missingFilesPlus1 := strings.Join(getFileIDs(missingFiles), ",")
|
missingFilesPlus1 := strings.Join(getFileIDs(missingFiles), ",")
|
||||||
missingFilesPlus1 += fmt.Sprintf(",%d", otherStreamableFileIDs[0])
|
missingFilesPlus1 += fmt.Sprintf(",%d", otherStreamableFileIDs[0])
|
||||||
|
log.Println("Trying to reinsert with 1 extra file", missingFilesPlus1)
|
||||||
t.reinsertTorrent(torrent, missingFilesPlus1, false)
|
t.reinsertTorrent(torrent, missingFilesPlus1, false)
|
||||||
} else {
|
} else if len(selectedFiles) > 1 {
|
||||||
// if not, last resort: add only the missing files but do it in 2 batches
|
// if not, last resort: add only the missing files but do it in 2 batches
|
||||||
half := len(missingFiles) / 2
|
half := len(missingFiles) / 2
|
||||||
missingFiles1 := strings.Join(getFileIDs(missingFiles[:half]), ",")
|
missingFiles1 := strings.Join(getFileIDs(missingFiles[:half]), ",")
|
||||||
missingFiles2 := strings.Join(getFileIDs(missingFiles[half:]), ",")
|
missingFiles2 := strings.Join(getFileIDs(missingFiles[half:]), ",")
|
||||||
if missingFiles1 != "" {
|
if missingFiles1 != "" {
|
||||||
|
log.Println("Trying to reinsert with 1/2 batches", missingFiles1)
|
||||||
t.reinsertTorrent(torrent, missingFiles1, false)
|
t.reinsertTorrent(torrent, missingFiles1, false)
|
||||||
}
|
}
|
||||||
if missingFiles2 != "" {
|
if missingFiles2 != "" {
|
||||||
|
log.Println("Trying to reinsert with 2/2 batches", missingFiles2)
|
||||||
t.reinsertTorrent(torrent, missingFiles2, false)
|
t.reinsertTorrent(torrent, missingFiles2, false)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Println("Cannot repair", torrent.Name)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
log.Println("Waiting for downloads to finish")
|
log.Println("Waiting for downloads to finish")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user