Check for other broken files when repairing
This commit is contained in:
@@ -234,7 +234,7 @@ func (t *TorrentManager) writeInfoToFile(info *realdebrid.TorrentInfo) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
t.log.Debugf("Saved torrent %s to info file", info.ID)
|
// t.log.Debugf("Saved torrent %s to info file", info.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TorrentManager) readInfoFromFile(torrentID string) *realdebrid.TorrentInfo {
|
func (t *TorrentManager) readInfoFromFile(torrentID string) *realdebrid.TorrentInfo {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ func (t *TorrentManager) refreshTorrents() []string {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
existingIDs.Difference(freshIDs).Each(func(id string) bool {
|
existingIDs.Difference(freshIDs).Each(func(id string) bool {
|
||||||
t.log.Infof("Deleting stale info file %s", id)
|
// t.log.Infof("Deleting stale info file %s", id)
|
||||||
t.deleteInfoFile(id)
|
t.deleteInfoFile(id)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -498,8 +498,6 @@ func (t *TorrentManager) persistBins() {
|
|||||||
_, err = file.Write(jsonData)
|
_, err = file.Write(jsonData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.log.Errorf("Failed to write to bins.json file: %v", err)
|
t.log.Errorf("Failed to write to bins.json file: %v", err)
|
||||||
} else {
|
|
||||||
t.log.Debug("Successfully saved bins to file")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,16 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for other broken files
|
||||||
|
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||||
|
if !file.State.Is("ok_file") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if t.UnrestrictFileUntilOk(file) == nil {
|
||||||
|
file.State.Event(context.Background(), "break_file")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
brokenFiles, allBroken := getBrokenFiles(torrent)
|
brokenFiles, allBroken := getBrokenFiles(torrent)
|
||||||
|
|
||||||
// first step: redownload the whole torrent
|
// first step: redownload the whole torrent
|
||||||
|
|||||||
Reference in New Issue
Block a user