initial commit
This commit is contained in:
47
parsed_torrent.go
Normal file
47
parsed_torrent.go
Normal file
@ -0,0 +1,47 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.tordarus.net/tordarus/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
|
||||
}
|
Reference in New Issue
Block a user