Fix Added bug in torrent
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user