diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 86a2467..b02720c 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -262,9 +262,7 @@ func (t *TorrentManager) convertToTorrent(info *realdebrid.TorrentInfo) *Torrent } } torrent.UnassignedLinks = mapset.NewSet[string]() - if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil { - t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err) - } + torrent.State.Event(context.Background(), "mark_as_repaired") } else { torrent.UnassignedLinks = mapset.NewSet[string]() for _, link := range info.Links { @@ -361,9 +359,7 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent { }) if brokenCount == 0 && okCount > 0 { - if err := mergedTorrent.State.Event(context.Background(), "mark_as_repaired"); err != nil { - t.log.Errorf("Cannot repair torrent %s: %v", t, t.GetKey(mergedTorrent), err) - } + mergedTorrent.State.Event(context.Background(), "mark_as_repaired") } return mergedTorrent diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 4e08a55..537896d 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -182,10 +182,7 @@ func (t *TorrentManager) repair(torrent *Torrent) { info, err := t.redownloadTorrent(torrent, []string{}) // reinsert the whole torrent, passing empty selection if info != nil && info.Progress == 100 && !t.isStillBroken(info, brokenFiles) { // successful repair - if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil { - t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err) - return - } + torrent.State.Event(context.Background(), "mark_as_repaired") // delete old torrents torrent.DownloadedIDs.Each(func(torrentID string) bool { if torrentID != info.ID { @@ -202,7 +199,7 @@ func (t *TorrentManager) repair(torrent *Torrent) { } if err != nil { - t.log.Warnf("Cannot repair torrent %s by redownloading all files (error=%s)", t.GetKey(torrent), err.Error()) + t.log.Warnf("Cannot repair torrent %s by redownloading all files (error=%v)", t.GetKey(torrent), err) } else { t.log.Warnf("Cannot repair torrent %s by redownloading all files", t.GetKey(torrent)) } @@ -234,7 +231,7 @@ func (t *TorrentManager) repair(torrent *Torrent) { batchNum++ redownloadedInfo, err := t.redownloadTorrent(torrent, group) if err != nil { - t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%s) giving up", t.GetKey(torrent), err.Error()) + t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%v) giving up", t.GetKey(torrent), err) for _, newId := range newlyDownloadedIds { t.setToBinImmediately(newId) } @@ -250,7 +247,7 @@ func (t *TorrentManager) repair(torrent *Torrent) { if len(group) > 0 { redownloadedInfo, err := t.redownloadTorrent(torrent, group) if err != nil { - t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%s) giving up", t.GetKey(torrent), err.Error()) + t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%v) giving up", t.GetKey(torrent), err) for _, newId := range newlyDownloadedIds { t.setToBinImmediately(newId) } @@ -353,9 +350,7 @@ func (t *TorrentManager) assignLinks(torrent *Torrent) bool { torrent.UnassignedLinks = mapset.NewSet[string]() t.markAsUnfixable(torrent, "rar'ed by RD") t.markAsUnplayable(torrent, "rar'ed by RD") - if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil { - t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err) - } + torrent.State.Event(context.Background(), "mark_as_repaired") } return false // end repair } diff --git a/internal/universal/check.go b/internal/universal/check.go index a43d639..71ad47c 100644 --- a/internal/universal/check.go +++ b/internal/universal/check.go @@ -28,7 +28,7 @@ func CheckFile(directory, torrentName, fileName string, w http.ResponseWriter, r file, ok := torrent.SelectedFiles.Get(fileName) if !ok || !file.State.Is("ok_file") { - log.Warnf("Cannot find file %s from path %s", fileName, req.URL.Path) + // log.Warnf("Cannot find file %s from path %s", fileName, req.URL.Path) http.Error(w, "File not found", http.StatusNotFound) return } diff --git a/internal/universal/downloader.go b/internal/universal/downloader.go index 9015011..a2d1a81 100644 --- a/internal/universal/downloader.go +++ b/internal/universal/downloader.go @@ -51,7 +51,7 @@ func (dl *Downloader) DownloadFile( file, ok := torrent.SelectedFiles.Get(fileName) if !ok || !file.State.Is("ok_file") { - log.Warnf("Cannot find file %s from path %s", fileName, req.URL.Path) + // log.Warnf("Cannot find file %s from path %s", fileName, req.URL.Path) http.Error(resp, "File not found", http.StatusNotFound) return }