model/parsed_torrent.go

48 lines
918 B
Go
Raw Normal View History

2022-08-03 19:58:31 +02:00
package model
2022-08-15 14:23:39 +02:00
import (
"fmt"
"strings"
"git.milar.in/milarin/anilist"
)
2022-08-04 00:23:02 +02:00
2022-08-03 19:58:31 +02:00
type ParsedTorrent struct {
2022-08-15 11:35:49 +02:00
// parsed data
Anime *anilist.Media
OriginalAnimeTitle string
Episode int
Languages []string
Subtitles []string
Resolution Resolution
2022-08-15 11:35:49 +02:00
// meta data
Torrent *Torrent
Parser *Parser
2022-08-03 19:58:31 +02:00
}
2022-08-15 14:23:39 +02:00
2022-08-22 11:35:41 +02:00
var _ PropertyHolder = &ParsedTorrent{}
2022-08-15 14:23:39 +02:00
func (t ParsedTorrent) String() string {
2022-08-21 14:38:44 +02:00
return fmt.Sprintf("title: %s | episode: %d | resolution: %s | languages: %s | subtitles: %s | %s",
2022-08-15 14:23:39 +02:00
t.Anime.Title.Native,
t.Episode,
t.Resolution,
strings.Join(t.Languages, ", "),
strings.Join(t.Subtitles, ", "),
2022-08-21 14:38:44 +02:00
t.Torrent.StringWithoutTitle(),
2022-08-15 14:23:39 +02:00
)
}
2022-08-22 11:35:41 +02:00
func (t *ParsedTorrent) GetLanguages() []string {
return t.Languages
}
func (t *ParsedTorrent) GetSubtitles() []string {
return t.Subtitles
}
func (t *ParsedTorrent) GetResolution() Resolution {
return t.Resolution
}