Fix bugs
This commit is contained in:
@@ -43,6 +43,7 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
}
|
||||
freshKeys.Add(info.AccessKey)
|
||||
if torrent, exists := allTorrents.Get(info.AccessKey); !exists {
|
||||
t.allAccessKeys.Add(info.AccessKey)
|
||||
allTorrents.Set(info.AccessKey, info)
|
||||
} else if !strset.Difference(info.DownloadedIDs, torrent.DownloadedIDs).IsEmpty() {
|
||||
mainTorrent := t.mergeToMain(torrent, info)
|
||||
@@ -50,17 +51,10 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
}
|
||||
}
|
||||
t.log.Infof("Compiled into %d torrents, %d were missing info", allTorrents.Count(), noInfoCount)
|
||||
|
||||
// removed
|
||||
strset.Difference(t.accessKeySet, freshKeys).Each(func(accessKey string) bool {
|
||||
t.accessKeySet.Remove(accessKey)
|
||||
t.Delete(accessKey, false)
|
||||
return true
|
||||
})
|
||||
// new
|
||||
var updatedPaths []string
|
||||
strset.Difference(freshKeys, t.accessKeySet).Each(func(accessKey string) bool {
|
||||
t.accessKeySet.Add(accessKey)
|
||||
// torrents yet to be assigned in a directory
|
||||
strset.Difference(freshKeys, t.allAccessKeys).Each(func(accessKey string) bool {
|
||||
// assign to directories
|
||||
tor, _ := allTorrents.Get(accessKey)
|
||||
t.assignedDirectoryCb(tor, func(directory string) {
|
||||
if strings.HasPrefix(directory, "int__") {
|
||||
@@ -72,6 +66,11 @@ func (t *TorrentManager) RefreshTorrents() []string {
|
||||
})
|
||||
return true
|
||||
})
|
||||
// removed torrents
|
||||
strset.Difference(t.allAccessKeys, freshKeys).Each(func(accessKey string) bool {
|
||||
t.Delete(accessKey, false)
|
||||
return true
|
||||
})
|
||||
|
||||
t.SetNewLatestState(t.getCurrentState())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user