Adjust file reads and writes

This commit is contained in:
Ben Sarmiento
2024-05-20 22:57:20 +02:00
parent a3a24124a8
commit d5dd9426ed
5 changed files with 22 additions and 34 deletions

View File

@@ -544,27 +544,3 @@ func (t *TorrentManager) isStillBroken(info *realdebrid.TorrentInfo, brokenFiles
}
return false
}
func getSelectedFiles(info *realdebrid.TorrentInfo) []*File {
var selectedFiles []*File
// if some Links are empty, we need to repair it
for _, file := range info.Files {
if file.Selected == 0 {
continue
}
selectedFiles = append(selectedFiles, &File{
File: file,
Ended: info.Ended,
Link: "", // no link yet
IsBroken: true,
})
}
if len(selectedFiles) == len(info.Links) {
// all links are still intact! good!
for i, file := range selectedFiles {
file.Link = info.Links[i]
file.IsBroken = false
}
}
return selectedFiles
}