initial commit
This commit is contained in:
28
torrent_priority.go
Normal file
28
torrent_priority.go
Normal file
@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.tordarus.net/nyaanime/logic"
|
||||
"git.tordarus.net/nyaanime/model"
|
||||
)
|
||||
|
||||
type TorrentPriority struct {
|
||||
ParsedTorrent *model.ParsedTorrent
|
||||
Priority int
|
||||
PreferredProperties map[string]int
|
||||
}
|
||||
|
||||
func NewTorrentPriority(torrent *model.ParsedTorrent) *TorrentPriority {
|
||||
priority, preferredProperties := logic.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)
|
||||
}
|
Reference in New Issue
Block a user