From 5e723a9e8a68a07befab0d089df3bc12f5f467fb Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Sun, 12 Nov 2023 02:22:27 +0100 Subject: [PATCH] fix on check --- internal/torrent/manager.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/torrent/manager.go b/internal/torrent/manager.go index 3e89c82..fdb11d9 100644 --- a/internal/torrent/manager.go +++ b/internal/torrent/manager.go @@ -262,10 +262,13 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent { var err error // file cache torrentFromFile := t.readFromFile(rdTorrent.ID) - if torrentFromFile != nil && len(torrentFromFile.ID) > 0 && len(torrentFromFile.Links) == len(rdTorrent.Links) && torrentFromFile.Links[0] == rdTorrent.Links[0] { - // see if api data and file data still match - // then it means data is still usable - info = torrentFromFile + if torrentFromFile != nil && len(torrentFromFile.ID) > 0 && len(torrentFromFile.Links) == len(rdTorrent.Links) { + if (len(torrentFromFile.Links) > 0 && torrentFromFile.Links[0] == rdTorrent.Links[0]) || len(torrentFromFile.Links) == 0 { + // see if api data and file data still match + // then it means data is still usable + info = torrentFromFile + info.Progress = rdTorrent.Progress + } } if info == nil { info, err = t.api.GetTorrentInfo(rdTorrent.ID)