Save based on access key and dont retry code 19
This commit is contained in:
@@ -103,7 +103,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
|||||||
allTorrents.IterCb(func(_ string, torrent *Torrent) {
|
allTorrents.IterCb(func(_ string, torrent *Torrent) {
|
||||||
t.applyMediaInfoDetails(torrent)
|
t.applyMediaInfoDetails(torrent)
|
||||||
t.writeTorrentToFile(torrent)
|
t.writeTorrentToFile(torrent)
|
||||||
t.log.Debugf("Applied media info details to torrent %s", torrent.Hash)
|
t.log.Debugf("Applied media info details to torrent %s", t.GetKey(torrent))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ func (t *TorrentManager) writeTorrentToFile(torrent *Torrent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
t.log.Debugf("Saved torrent %s (hash=%s) to file", t.GetKey(torrent), torrent.Hash)
|
t.log.Debugf("Saved torrent %s to file", t.GetKey(torrent), torrent.Hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TorrentManager) applyMediaInfoDetails(torrent *Torrent) {
|
func (t *TorrentManager) applyMediaInfoDetails(torrent *Torrent) {
|
||||||
|
|||||||
@@ -48,11 +48,10 @@ func (t *TorrentManager) refreshTorrents() []string {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
existingHashes := mapset.NewSet[string]()
|
cachedAccessKeys := mapset.NewSet[string]()
|
||||||
t.getTorrentFiles("data").Each(func(path string) bool {
|
t.getTorrentFiles("data").Each(func(path string) bool {
|
||||||
path = filepath.Base(path)
|
path = filepath.Base(path)
|
||||||
hash := strings.TrimSuffix(path, ".zurgtorrent")
|
cachedAccessKeys.Add(strings.TrimSuffix(path, ".zurgtorrent"))
|
||||||
existingHashes.Add(hash)
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -96,7 +95,7 @@ func (t *TorrentManager) refreshTorrents() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write to file if it is a new torrent
|
// write to file if it is a new torrent
|
||||||
if forMerging == nil && !existingHashes.Contains(tInfo.Hash) {
|
if forMerging == nil && !cachedAccessKeys.Contains(accessKey) {
|
||||||
t.writeTorrentToFile(torrent)
|
t.writeTorrentToFile(torrent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,9 +323,14 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
older.SelectedFiles.IterCb(func(key string, file *File) {
|
older.SelectedFiles.IterCb(func(key string, file *File) {
|
||||||
if f, ok := mergedTorrent.SelectedFiles.Get(key); !ok || !f.State.Is("ok_file") {
|
mediaInfo := file.MediaInfo
|
||||||
|
f, ok := mergedTorrent.SelectedFiles.Get(key)
|
||||||
|
if !ok || !f.State.Is("ok_file") {
|
||||||
mergedTorrent.SelectedFiles.Set(key, file)
|
mergedTorrent.SelectedFiles.Set(key, file)
|
||||||
}
|
}
|
||||||
|
if ok && f.MediaInfo == nil && mediaInfo != nil {
|
||||||
|
f.MediaInfo = mediaInfo
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// unassigned links
|
// unassigned links
|
||||||
|
|||||||
@@ -269,8 +269,6 @@ func (r *HTTPClient) shouldRetry(req *http.Request, resp *http.Response, err err
|
|||||||
return 1
|
return 1
|
||||||
case 18: // Hoster limit reached
|
case 18: // Hoster limit reached
|
||||||
return 1
|
return 1
|
||||||
case 19: // Hoster temporarily unavailable
|
|
||||||
return 1
|
|
||||||
case 25: // Service unavailable
|
case 25: // Service unavailable
|
||||||
return 1
|
return 1
|
||||||
case 34: // Too many requests (retry infinitely), default: 4 secs
|
case 34: // Too many requests (retry infinitely), default: 4 secs
|
||||||
|
|||||||
Reference in New Issue
Block a user