48 lines
918 B
Go
48 lines
918 B
Go
package model
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"git.milar.in/milarin/anilist"
|
|
)
|
|
|
|
type ParsedTorrent struct {
|
|
// parsed data
|
|
Anime *anilist.Media
|
|
OriginalAnimeTitle string
|
|
Episode int
|
|
Languages []string
|
|
Subtitles []string
|
|
Resolution Resolution
|
|
|
|
// meta data
|
|
Torrent *Torrent
|
|
Parser *Parser
|
|
}
|
|
|
|
var _ PropertyHolder = &ParsedTorrent{}
|
|
|
|
func (t ParsedTorrent) String() string {
|
|
return fmt.Sprintf("title: %s | episode: %d | resolution: %s | languages: %s | subtitles: %s | %s",
|
|
t.Anime.Title.Native,
|
|
t.Episode,
|
|
t.Resolution,
|
|
strings.Join(t.Languages, ", "),
|
|
strings.Join(t.Subtitles, ", "),
|
|
t.Torrent.StringWithoutTitle(),
|
|
)
|
|
}
|
|
|
|
func (t *ParsedTorrent) GetLanguages() []string {
|
|
return t.Languages
|
|
}
|
|
|
|
func (t *ParsedTorrent) GetSubtitles() []string {
|
|
return t.Subtitles
|
|
}
|
|
|
|
func (t *ParsedTorrent) GetResolution() Resolution {
|
|
return t.Resolution
|
|
}
|