Repair rework for rar files

This commit is contained in:
Ben Sarmiento
2024-01-07 14:24:21 +01:00
parent e5f0f4d7bd
commit 72f7b0f1e5
5 changed files with 97 additions and 73 deletions

View File

@@ -149,7 +149,6 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
}
selectedFiles = append(selectedFiles, &File{
File: file,
Added: info.Added,
Ended: info.Ended,
Link: "", // no link yet
})
@@ -159,6 +158,9 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
for i, file := range selectedFiles {
file.Link = info.Links[i]
}
torrent.UnassignedLinks = mapset.NewSet[string]()
} else {
torrent.UnassignedLinks = mapset.NewSet[string](info.Links...)
}
torrent.SelectedFiles = cmap.New[*File]()
for _, file := range selectedFiles {
@@ -195,6 +197,7 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
mainTorrent.DownloadedIDs = mapset.NewSet[string]()
mainTorrent.InProgressIDs = mapset.NewSet[string]()
mainTorrent.Unfixable = existing.Unfixable || toMerge.Unfixable
mainTorrent.UnassignedLinks = existing.UnassignedLinks.Union(toMerge.UnassignedLinks)
// this function triggers only when we have a new DownloadedID
toMerge.DownloadedIDs.Difference(existing.DownloadedIDs).Each(func(id string) bool {