28 lines
604 B
Go
28 lines
604 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.milar.in/nyaanime/model"
|
|
)
|
|
|
|
type TorrentPriority struct {
|
|
ParsedTorrent *model.ParsedTorrent
|
|
Priority int
|
|
PreferredProperties map[string]int
|
|
}
|
|
|
|
func NewTorrentPriority(torrent *model.ParsedTorrent) *TorrentPriority {
|
|
priority, preferredProperties := DeterminePriority(torrent)
|
|
|
|
return &TorrentPriority{
|
|
ParsedTorrent: torrent,
|
|
Priority: priority,
|
|
PreferredProperties: preferredProperties,
|
|
}
|
|
}
|
|
|
|
func (tp TorrentPriority) String() string {
|
|
return fmt.Sprintf("%s | priority: %d", tp.ParsedTorrent.String(), tp.Priority)
|
|
}
|