Allow repairing file from ok state

This commit is contained in:
Ben Sarmiento
2024-05-24 18:12:32 +02:00
parent 7695412b22
commit bb316a1bfd
2 changed files with 3 additions and 11 deletions

View File

@@ -257,9 +257,7 @@ func (t *TorrentManager) convertToTorrent(info *realdebrid.TorrentInfo) *Torrent
if strings.HasPrefix(file.Link, "https://real-debrid.com/d/") {
file.Link = file.Link[0:39]
}
if err := file.State.Event(context.Background(), "repair_file"); err != nil {
t.log.Errorf("Cannot repair file %s: %v", file.Path, err)
}
file.State.Event(context.Background(), "repair_file")
}
torrent.UnassignedLinks = mapset.NewSet[string]()
torrent.State.Event(context.Background(), "mark_as_repaired")

View File

@@ -289,10 +289,7 @@ func (t *TorrentManager) assignLinks(torrent *Torrent) bool {
if strings.HasPrefix(file.Link, "https://real-debrid.com/d/") {
file.Link = file.Link[0:39]
}
if err := file.State.Event(context.Background(), "repair_file"); err != nil {
t.log.Errorf("Failed to mark file %s as repaired: %v", file.Path, err)
return
}
file.State.Event(context.Background(), "repair_file")
assigned = true
assignedCount++
}
@@ -552,10 +549,7 @@ func (t *TorrentManager) isStillBroken(info *realdebrid.TorrentInfo, brokenFiles
if strings.HasPrefix(file.Link, "https://real-debrid.com/d/") {
file.Link = file.Link[0:39]
}
if err := file.State.Event(context.Background(), "repair_file"); err != nil {
t.log.Errorf("Failed to mark file %s as repaired: %v", file.Path, err)
return true
}
file.State.Event(context.Background(), "repair_file")
}
if len(brokenFiles) == 0 {