Simplify bin
This commit is contained in:
@@ -38,13 +38,21 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
|
||||
idx := i
|
||||
t.workerPool.Submit(func() {
|
||||
defer wg.Done()
|
||||
if t.binOnceDoneErrorCheck(instances[idx].ID, instances[idx].Status) ||
|
||||
instances[idx].Progress != 100 {
|
||||
status := instances[idx].Status
|
||||
if status != "downloading" && status != "downloaded" && status != "uploading" && status != "queued" && status != "compressing" && status != "waiting_files_selection" {
|
||||
t.deleteOnceDone(instances[idx].ID, true)
|
||||
}
|
||||
if instances[idx].Progress != 100 {
|
||||
mergeChan <- nil
|
||||
return
|
||||
}
|
||||
|
||||
tInfo := t.getMoreInfo(instances[idx])
|
||||
if tInfo == nil {
|
||||
// just in case!
|
||||
mergeChan <- nil
|
||||
return
|
||||
}
|
||||
torrent := t.convertToTorrent(tInfo)
|
||||
accessKey := t.GetKey(torrent)
|
||||
freshAccessKeys.Add(accessKey)
|
||||
@@ -113,12 +121,11 @@ func (t *TorrentManager) refreshTorrents(initialRun bool) {
|
||||
t.getInfoFiles().Each(func(path string) bool {
|
||||
path = filepath.Base(path)
|
||||
torrentID := strings.TrimSuffix(path, ".zurginfo")
|
||||
// if binOnceDone returns true, it means the info file is deleted
|
||||
// if false, then we check if it's one of the torrents we just fetched
|
||||
// if not (both are false), then we delete the info file
|
||||
if !t.binOnceDone(torrentID, false) && !freshIDs.ContainsOne(torrentID) {
|
||||
if !freshIDs.ContainsOne(torrentID) {
|
||||
t.deleteInfoFile(torrentID)
|
||||
return false
|
||||
}
|
||||
t.deleteOnceDone(torrentID, false)
|
||||
return false
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user