2022-08-21 21:14:44 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2023-01-13 13:38:51 +01:00
|
|
|
"git.milar.in/nyaanime/logic"
|
2022-08-21 21:14:44 +02:00
|
|
|
"git.milar.in/nyaanime/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TorrentPriority struct {
|
|
|
|
ParsedTorrent *model.ParsedTorrent
|
|
|
|
Priority int
|
|
|
|
PreferredProperties map[string]int
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewTorrentPriority(torrent *model.ParsedTorrent) *TorrentPriority {
|
2023-01-13 13:38:51 +01:00
|
|
|
priority, preferredProperties := logic.DeterminePriority(torrent)
|
2022-08-21 21:14:44 +02:00
|
|
|
|
|
|
|
return &TorrentPriority{
|
|
|
|
ParsedTorrent: torrent,
|
|
|
|
Priority: priority,
|
|
|
|
PreferredProperties: preferredProperties,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tp TorrentPriority) String() string {
|
|
|
|
return fmt.Sprintf("%s | priority: %d", tp.ParsedTorrent.String(), tp.Priority)
|
|
|
|
}
|