Repair optimizations

This commit is contained in:
Ben Sarmiento
2023-11-19 02:00:50 +01:00
parent 0b21b8d58c
commit 2923f3918d
4 changed files with 43 additions and 27 deletions

View File

@@ -81,7 +81,8 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *intTor.TorrentM
resp := t.UnrestrictUntilOk(link)
if resp == nil {
log.Warnf("File %s is no longer available", file.Path)
file.Link = ""
file.Link = "@"
file.ForRepair = true
t.SetChecksum("") // force a recheck
streamErrorVideo("https://www.youtube.com/watch?v=gea_FJrtFVA", w, r, t, c, log)
} else {
@@ -126,7 +127,8 @@ func streamFileToResponse(file *intTor.File, url string, w http.ResponseWriter,
if err != nil {
if file != nil {
log.Warnf("Cannot download file %s: %v", file.Path, err)
file.Link = ""
file.Link = "@"
file.ForRepair = true
torMgr.SetChecksum("") // force a recheck
}
streamErrorVideo("https://www.youtube.com/watch?v=FSSd8cponAA", w, r, torMgr, cfg, log)
@@ -137,7 +139,8 @@ func streamFileToResponse(file *intTor.File, url string, w http.ResponseWriter,
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent {
if file != nil {
log.Warnf("Received a %s status code for file %s", resp.Status, file.Path)
file.Link = ""
file.Link = "@"
file.ForRepair = true
torMgr.SetChecksum("") // force a recheck
}
streamErrorVideo("https://www.youtube.com/watch?v=BcseUxviVqE", w, r, torMgr, cfg, log)