From aff12c2e4b180de0805041bf80a31c177fbab4b8 Mon Sep 17 00:00:00 2001 From: Mukhtar Akere Date: Thu, 28 Aug 2025 03:26:43 +0100 Subject: [PATCH] Fix Added bug in torrent --- pkg/debrid/providers/alldebrid/alldebrid.go | 1 + pkg/debrid/providers/realdebrid/realdebrid.go | 4 +++- pkg/debrid/providers/torbox/torbox.go | 1 + pkg/debrid/store/repair.go | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/debrid/providers/alldebrid/alldebrid.go b/pkg/debrid/providers/alldebrid/alldebrid.go index 4cd8bb3..d1b8797 100644 --- a/pkg/debrid/providers/alldebrid/alldebrid.go +++ b/pkg/debrid/providers/alldebrid/alldebrid.go @@ -107,6 +107,7 @@ func (ad *AllDebrid) SubmitMagnet(torrent *types.Torrent) (*types.Torrent, error magnet := magnets[0] torrentId := strconv.Itoa(magnet.ID) torrent.Id = torrentId + torrent.Added = time.Now().Format(time.RFC3339) return torrent, nil } diff --git a/pkg/debrid/providers/realdebrid/realdebrid.go b/pkg/debrid/providers/realdebrid/realdebrid.go index 17e1062..491545d 100644 --- a/pkg/debrid/providers/realdebrid/realdebrid.go +++ b/pkg/debrid/providers/realdebrid/realdebrid.go @@ -372,6 +372,7 @@ func (r *RealDebrid) addTorrent(t *types.Torrent) (*types.Torrent, error) { t.Id = data.Id t.Debrid = r.name t.MountPath = r.MountPath + t.Added = time.Now().Format(time.RFC3339) return t, nil } @@ -407,6 +408,7 @@ func (r *RealDebrid) addMagnet(t *types.Torrent) (*types.Torrent, error) { t.Id = data.Id t.Debrid = r.name t.MountPath = r.MountPath + t.Added = time.Now().Format(time.RFC3339) return t, nil } @@ -488,7 +490,6 @@ func (r *RealDebrid) UpdateTorrent(t *types.Torrent) error { t.Links = data.Links t.MountPath = r.MountPath t.Debrid = r.name - t.Added = data.Added t.Files, _ = r.getSelectedFiles(t, data) // Get selected files return nil @@ -520,6 +521,7 @@ func (r *RealDebrid) CheckStatus(t *types.Torrent) (*types.Torrent, error) { t.Status = status t.Debrid = r.name t.MountPath = r.MountPath + t.Added = data.Added if status == "waiting_files_selection" { t.Files = r.getTorrentFiles(t, data) if len(t.Files) == 0 { diff --git a/pkg/debrid/providers/torbox/torbox.go b/pkg/debrid/providers/torbox/torbox.go index 04fdbc7..fee176b 100644 --- a/pkg/debrid/providers/torbox/torbox.go +++ b/pkg/debrid/providers/torbox/torbox.go @@ -161,6 +161,7 @@ func (tb *Torbox) SubmitMagnet(torrent *types.Torrent) (*types.Torrent, error) { torrent.Id = torrentId torrent.MountPath = tb.MountPath torrent.Debrid = tb.name + torrent.Added = time.Now().Format(time.RFC3339) return torrent, nil } diff --git a/pkg/debrid/store/repair.go b/pkg/debrid/store/repair.go index 9afe804..c4fe406 100644 --- a/pkg/debrid/store/repair.go +++ b/pkg/debrid/store/repair.go @@ -262,7 +262,7 @@ func (c *Cache) reInsertTorrent(ct *CachedTorrent) (*CachedTorrent, error) { _ = c.client.DeleteTorrent(newTorrent.Id) } c.markAsFailedToReinsert(oldID) - return ct, err + return ct, fmt.Errorf("failed to check torrent: %w", err) } // Update the torrent in the cache @@ -295,7 +295,7 @@ func (c *Cache) reInsertTorrent(ct *CachedTorrent) (*CachedTorrent, error) { } } - req.Complete(ct, err) + req.Complete(ct, nil) c.markAsSuccessfullyReinserted(oldID) c.logger.Debug().Str("torrentId", torrent.Id).Msg("Torrent successfully reinserted")