Change some logs

This commit is contained in:
Ben Sarmiento
2024-04-19 11:41:12 +02:00
parent 0c937968b7
commit 2ff754e06e

View File

@@ -218,6 +218,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
t.fixerAddCommand(redownloadedInfo.ID, "repaired")
return
}
t.log.Error("This is not supposed to happen, we should have repaired the torrent by now")
}
t.log.Infof("Repairing by downloading 2 batches of the broken %d files of torrent %s", len(brokenFiles), t.GetKey(torrent))
@@ -395,7 +396,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) (
}
// documented status: magnet_error, magnet_conversion, waiting_files_selection, queued, downloading, downloaded, error, virus, compressing, uploading, dead
okStatuses := []string{"magnet_conversion", "waiting_files_selection", "queued", "downloading", "downloaded", "uploading"}
okStatuses := []string{"downloading", "downloaded", "uploading"}
// not compressing because we need playable files
isOkStatus := false
for _, status := range okStatuses {
@@ -405,8 +406,8 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) (
}
}
if !isOkStatus {
t.fixerAddCommand(newTorrentID, "download_failed")
return nil, fmt.Errorf("the redownloaded torrent %s (id=%s) is in error state: %s", t.GetKey(torrent), newTorrentID, info.Status)
t.fixerAddCommand(info.ID, "download_failed")
return nil, fmt.Errorf("the redownloaded torrent %s (id=%s) is in a non-OK state: %s", t.GetKey(torrent), info.ID, info.Status)
}
// check if incorrect number of links
@@ -416,7 +417,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) (
return nil, fmt.Errorf("it did not fix the issue for %s (id=%s), only got %d files but we need %d, undoing", t.GetKey(torrent), info.ID, len(info.Links), selectionCount)
}
t.log.Infof("Redownloading torrent %s successful (progress=%d)", t.GetKey(torrent), info.Progress)
t.log.Infof("Redownloading torrent %s successful (id=%s, progress=%d)", t.GetKey(torrent), info.ID, info.Progress)
for _, id := range oldTorrentIDs {
t.fixerAddCommand(id, "replaced")
}