This commit is contained in:
Mukhtar Akere
2025-04-29 12:07:01 +01:00
parent 6c2bfa811a
commit c0703cb622
3 changed files with 5 additions and 4 deletions

View File

@@ -428,10 +428,10 @@ func (c *Cache) setTorrent(t *CachedTorrent) {
// keep the one with the most recent added date // keep the one with the most recent added date
// Save the most recent torrent // Save the most recent torrent
mergedFiles := mergeFiles(t, o) // Useful for merging files across multiple torrents, while keeping the most recent
if o.AddedOn.After(t.AddedOn) { if o.AddedOn.After(t.AddedOn) {
t = o t = o
} }
mergedFiles := mergeFiles(t, o) // Useful for merging files across multiple torrents, while keeping the most recent
t.Files = mergedFiles t.Files = mergedFiles
} }
@@ -445,10 +445,10 @@ func (c *Cache) setTorrents(torrents map[string]*CachedTorrent) {
c.torrents.Store(t.Id, torrentKey) c.torrents.Store(t.Id, torrentKey)
if o, ok := c.torrentsNames.Load(torrentKey); ok && o.Id != t.Id { if o, ok := c.torrentsNames.Load(torrentKey); ok && o.Id != t.Id {
// Save the most recent torrent // Save the most recent torrent
mergedFiles := mergeFiles(t, o) // Useful for merging files across multiple torrents, while keeping the most recent
if o.AddedOn.After(t.AddedOn) { if o.AddedOn.After(t.AddedOn) {
t = o t = o
} }
mergedFiles := mergeFiles(t, o)
t.Files = mergedFiles t.Files = mergedFiles
} }
c.torrentsNames.Store(torrentKey, t) c.torrentsNames.Store(torrentKey, t)

View File

@@ -109,12 +109,13 @@ func (q *QBit) ProcessFiles(torrent *Torrent, debridTorrent *debrid.Torrent, arr
if ok { if ok {
q.logger.Info().Msgf("Using internal webdav for %s", debridTorrent.Debrid) q.logger.Info().Msgf("Using internal webdav for %s", debridTorrent.Debrid)
// Use webdav to download the file // Use webdav to download the file
timer := time.Now()
if err := cache.AddTorrent(debridTorrent); err != nil { if err := cache.AddTorrent(debridTorrent); err != nil {
q.logger.Error().Msgf("Error adding torrent to cache: %v", err) q.logger.Error().Msgf("Error adding torrent to cache: %v", err)
q.MarkAsFailed(torrent) q.MarkAsFailed(torrent)
return return
} }
timer := time.Now()
rclonePath := filepath.Join(debridTorrent.MountPath, cache.GetTorrentFolder(debridTorrent)) // /mnt/remote/realdebrid/MyTVShow rclonePath := filepath.Join(debridTorrent.MountPath, cache.GetTorrentFolder(debridTorrent)) // /mnt/remote/realdebrid/MyTVShow
torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name) torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name)

View File

@@ -349,7 +349,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Err(err). Err(err).
Str("path", r.URL.Path). Str("path", r.URL.Path).
Msg("Could not fetch download link") Msg("Could not fetch download link")
http.Error(w, "Could not fetch download link", http.StatusServiceUnavailable) http.Error(w, "Could not fetch download link", http.StatusPreconditionFailed)
return return
} }
if link == "" { if link == "" {