do not overwrite info

This commit is contained in:
Ben Sarmiento
2024-01-11 06:55:31 +01:00
parent 3cdc2f8791
commit 628e3d6345
3 changed files with 40 additions and 10 deletions

View File

@@ -208,9 +208,9 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
// the link can have the following values
// 1. https://*** - the file is available
// 2. repair - the file is available but we need to repair it
// 3. repairing - the file is being repaired
// 4. unselect - the file is deleted
// 2. repair - the link is there but we need to repair it
// 3. unselect - the file is deleted
// 4. empty - the file is not available
mainTorrent.SelectedFiles = existing.SelectedFiles
toMerge.SelectedFiles.IterCb(func(filepath string, fileToMerge *File) {
// see if it already exists in the main torrent
@@ -219,7 +219,8 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
} else if originalFile.Link != "unselect" {
// if it exists, compare the LatestAdded property and the link
if existing.LatestAdded < toMerge.LatestAdded && strings.HasPrefix(fileToMerge.Link, "http") {
if existing.LatestAdded < toMerge.LatestAdded {
// && strings.HasPrefix(fileToMerge.Link, "http")
// if torrentToMerge is more recent and its file has a link, update the main torrent's file
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
}