diff --git a/internal/torrent/manager.go b/internal/torrent/manager.go index 99617d8..f11a449 100644 --- a/internal/torrent/manager.go +++ b/internal/torrent/manager.go @@ -234,7 +234,7 @@ func (t *TorrentManager) writeInfoToFile(info *realdebrid.TorrentInfo) { 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 { diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 5021603..091f13d 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -159,7 +159,7 @@ func (t *TorrentManager) refreshTorrents() []string { return false }) 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) return false }) @@ -498,8 +498,6 @@ func (t *TorrentManager) persistBins() { _, err = file.Write(jsonData) if err != nil { t.log.Errorf("Failed to write to bins.json file: %v", err) - } else { - t.log.Debug("Successfully saved bins to file") } } diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 1ce9ae0..ac69032 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -173,6 +173,16 @@ func (t *TorrentManager) repair(torrent *Torrent) { 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) // first step: redownload the whole torrent