fixed priority comparison
This commit is contained in:
parent
29de312a3f
commit
1026be5bd0
@ -41,7 +41,7 @@ func CheckTorrents() {
|
||||
// information gathered for logging purposes
|
||||
downloadingEpisodes := map[model.AnimeEpisode]struct{}{}
|
||||
inCollectionEpisodes := map[model.AnimeEpisode]bool{}
|
||||
lowerPrioTorrents := map[*model.ParsedTorrent]bool{}
|
||||
collectionPreferredTorrents := map[*model.ParsedTorrent]bool{}
|
||||
downloadedTorrents := map[model.AnimeEpisode]*TorrentPriority{}
|
||||
|
||||
for animeEp, torrentPrio := range preferredTorrents {
|
||||
@ -54,9 +54,9 @@ func CheckTorrents() {
|
||||
|
||||
inCollectionEpisodes[animeEp] = inCollection // debug output
|
||||
if inCollection {
|
||||
lowerPrio := props.Priority > torrentPrio.Priority
|
||||
lowerPrioTorrents[torrentPrio.ParsedTorrent] = lowerPrio // debug output
|
||||
if lowerPrio {
|
||||
collectionPreferred := props.Priority >= torrentPrio.Priority
|
||||
collectionPreferredTorrents[torrentPrio.ParsedTorrent] = collectionPreferred // debug output
|
||||
if collectionPreferred {
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ func CheckTorrents() {
|
||||
preferredTorrents,
|
||||
downloadingEpisodes,
|
||||
inCollectionEpisodes,
|
||||
lowerPrioTorrents,
|
||||
collectionPreferredTorrents,
|
||||
downloadedTorrents,
|
||||
)
|
||||
|
||||
|
16
go.sum
16
go.sum
@ -12,12 +12,12 @@ git.milar.in/milarin/slices v0.0.6 h1:AQoSarZ58WHYol9c6woWJSe8wFpPC2RC4cvIlZpfg9
|
||||
git.milar.in/milarin/slices v0.0.6/go.mod h1:NOr53AOeur/qscu/FBj3lsFR262PNYBccLYSTCAXRk4=
|
||||
git.milar.in/milarin/tprint v0.0.7 h1:dvm4l4BhXOie4vtnRMZii0WTLTz2wju8wyUPB/lNeVo=
|
||||
git.milar.in/milarin/tprint v0.0.7/go.mod h1:UwW/B+0cTCbN5hi0bQBE9rIRgLkq+x4V751rrS2KVoI=
|
||||
git.milar.in/nyaanime/logic v0.0.0-20230113101007-e0018688e419 h1:Am9LlW/2UJuUvWsoA2c9FPBJpTZfSWjHCkWSHlAoX8M=
|
||||
git.milar.in/nyaanime/logic v0.0.0-20230113101007-e0018688e419/go.mod h1:SkgdD87uNP60swIBtrDRZPBF5rLIgBLL6OetP1sETLY=
|
||||
git.milar.in/nyaanime/logic v0.0.0-20230114105336-6bfb7dce349f h1:tc8hQpZprt8/yedVSPmkftKOI2+P7twFc7BEov5RTBc=
|
||||
git.milar.in/nyaanime/logic v0.0.0-20230114105336-6bfb7dce349f/go.mod h1:cLuIBDTtpXdzprOIsz73r6ZCE5s0k+o6HA7fH9OuW/M=
|
||||
git.milar.in/nyaanime/model v0.0.0-20230113095840-5eb2822653c3 h1:mXcEA47FQQzeSDXE3UvhNfIt4fBfpDSq1/f0r+jbHpY=
|
||||
git.milar.in/nyaanime/model v0.0.0-20230113095840-5eb2822653c3/go.mod h1:kPWLDvFrhc1Uf77gxsBOxNeJ5JTVF2HhVs1IdVcw0tg=
|
||||
git.milar.in/nyaanime/parsers v0.0.0-20221207192513-e7bce7c418d8 h1:vb7jasvTdan0E8VY5snnRj1Xe+60NA7Lpn+GSYE6pW0=
|
||||
git.milar.in/nyaanime/parsers v0.0.0-20221207192513-e7bce7c418d8/go.mod h1:GG4vtUIfxopZc/+Y8OAa//vWJw/m6aeoGN7fw6SLiEM=
|
||||
git.milar.in/nyaanime/parsers v0.0.0-20230113101942-2c9bc6925201 h1:glTG4IeuIvD4mVwJyCF5SYMawCRcZZ01pz4AUyWTEP8=
|
||||
git.milar.in/nyaanime/parsers v0.0.0-20230113101942-2c9bc6925201/go.mod h1:GG4vtUIfxopZc/+Y8OAa//vWJw/m6aeoGN7fw6SLiEM=
|
||||
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
|
||||
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
|
||||
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
|
||||
@ -31,11 +31,11 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.3.4 h1:3Z3Eu6FGHZWSfNKJTOUiPatWwfc7DzJRU04jFUqJODw=
|
||||
github.com/rivo/uniseg v0.3.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
|
||||
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E=
|
||||
golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
|
@ -20,7 +20,7 @@ func ShowDebugInfo(
|
||||
preferredTorrents map[model.AnimeEpisode]*TorrentPriority,
|
||||
downloadingEpisodes map[model.AnimeEpisode]struct{},
|
||||
inCollectionEpisodes map[model.AnimeEpisode]bool,
|
||||
lowerPrioTorrents map[*model.ParsedTorrent]bool,
|
||||
collectionPreferredTorrents map[*model.ParsedTorrent]bool,
|
||||
downloadedTorrents map[model.AnimeEpisode]*TorrentPriority) {
|
||||
|
||||
for animeEp, parsedTorrents := range parsedTorrentsByAnimeEp {
|
||||
@ -30,7 +30,7 @@ func ShowDebugInfo(
|
||||
eval := getEvaluation(
|
||||
slices.Contains(essentialTorrents[animeEp], torrent),
|
||||
preferredTorrents[animeEp] != nil && preferredTorrents[animeEp].ParsedTorrent == torrent,
|
||||
lowerPrioTorrents[torrent],
|
||||
collectionPreferredTorrents[torrent],
|
||||
downloadedTorrents[animeEp] != nil && downloadedTorrents[animeEp].ParsedTorrent == torrent,
|
||||
)
|
||||
|
||||
@ -69,10 +69,10 @@ func ShowDebugInfo(
|
||||
}
|
||||
}
|
||||
|
||||
func getEvaluation(essential, preferred, lowerPrio, downloaded bool) string {
|
||||
func getEvaluation(essential, preferred, collectionPreferred, downloaded bool) string {
|
||||
if downloaded {
|
||||
return color.GreenString("DOWNLOAD STARTED")
|
||||
} else if lowerPrio {
|
||||
} else if collectionPreferred {
|
||||
return color.GreenString("collection preferred")
|
||||
} else if preferred {
|
||||
return color.BlueString("torrent preferred")
|
||||
|
Loading…
Reference in New Issue
Block a user