adjustments
This commit is contained in:
@@ -22,7 +22,7 @@ func (t *TorrentManager) fixerAddCommand(trigger, command string) {
|
||||
}
|
||||
|
||||
func (t *TorrentManager) processFixers(instances []realdebrid.Torrent) {
|
||||
t.log.Debugf("Processing fixers (%d left)", t.fixers.Count())
|
||||
t.log.Debugf("Processing fixers (%d left: %v)", t.fixers.Count(), t.fixers)
|
||||
var toDelete []string
|
||||
var toRedownload []*Torrent
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
|
||||
@@ -11,10 +11,7 @@ func (ls *LibraryState) Eq(a LibraryState) bool {
|
||||
if ls.TotalCount == 0 || ls.FirstActiveTorrentId == "" || ls.FirstTorrentId == "" {
|
||||
return false
|
||||
}
|
||||
if a.TotalCount != ls.TotalCount || a.ActiveCount != ls.ActiveCount || a.FirstActiveTorrentId != ls.FirstActiveTorrentId || a.FirstTorrentId != ls.FirstTorrentId {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return a.TotalCount == ls.TotalCount && a.ActiveCount == ls.ActiveCount && a.FirstActiveTorrentId == ls.FirstActiveTorrentId && a.FirstTorrentId == ls.FirstTorrentId
|
||||
}
|
||||
|
||||
func (t *TorrentManager) setNewLatestState(checksum LibraryState) {
|
||||
|
||||
@@ -56,7 +56,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w
|
||||
RemountTrigger: make(chan struct{}, 1),
|
||||
allAccessKeys: mapset.NewSet[string](),
|
||||
latestState: &LibraryState{},
|
||||
requiredVersion: "0.9.3-hotfix.4",
|
||||
requiredVersion: "0.9.3-hotfix.10",
|
||||
workerPool: workerPool,
|
||||
log: log,
|
||||
}
|
||||
|
||||
@@ -137,14 +137,16 @@ func (t *TorrentManager) StartRefreshJob() {
|
||||
// getMoreInfo gets original name, size and files for a torrent
|
||||
func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
|
||||
|
||||
if torrentFromCache, exists := infoCache.Get(rdTorrent.ID); exists &&
|
||||
!torrentFromCache.AnyInProgress() &&
|
||||
torrentFromCache.SelectedFiles.Count() == len(rdTorrent.Links) {
|
||||
return torrentFromCache
|
||||
|
||||
} else if !exists {
|
||||
torrentFromFile := t.readTorrentFromFile(rdTorrent.ID)
|
||||
|
||||
if torrentFromFile != nil &&
|
||||
!torrentFromFile.AnyInProgress() &&
|
||||
torrentFromFile.SelectedFiles.Count() == len(rdTorrent.Links) {
|
||||
|
||||
hasBrokenFiles := false
|
||||
@@ -158,8 +160,7 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
infoCache.Set(rdTorrent.ID, torrentFromFile)
|
||||
t.ResetSelectedFiles(torrentFromFile)
|
||||
return torrentFromFile
|
||||
} else {
|
||||
t.log.Warnf("Torrent %s has broken files, will not save on info cache", rdTorrent.ID)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,8 +226,11 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
torrent.InProgressIDs.Add(info.ID)
|
||||
}
|
||||
|
||||
infoCache.Set(rdTorrent.ID, &torrent)
|
||||
t.saveTorrentChangesToDisk(&torrent, nil)
|
||||
// save to cache if it's not in progress anymore
|
||||
if info.Progress == 100 {
|
||||
infoCache.Set(rdTorrent.ID, &torrent)
|
||||
t.saveTorrentChangesToDisk(&torrent, nil)
|
||||
}
|
||||
|
||||
return &torrent
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ func (t *Torrent) AnyInProgress() bool {
|
||||
}
|
||||
|
||||
func (t *Torrent) AllInProgress() bool {
|
||||
return t.DownloadedIDs.IsEmpty()
|
||||
return t.DownloadedIDs.IsEmpty() && !t.InProgressIDs.IsEmpty()
|
||||
}
|
||||
|
||||
func (t *Torrent) ComputeTotalSize() int64 {
|
||||
|
||||
Reference in New Issue
Block a user