From bb316a1bfda247ba0059abb4979295ef64c1d4d2 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Fri, 24 May 2024 18:12:32 +0200 Subject: [PATCH] Allow repairing file from ok state --- internal/torrent/refresh.go | 4 +--- internal/torrent/repair.go | 10 ++-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index b02720c..bd6bb8f 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -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") diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 537896d..bd45e15 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -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 {