added resolution

This commit is contained in:
Timon Ringwald 2022-08-04 17:49:59 +02:00
parent 96f16f9e05
commit f8b66e8c9e
2 changed files with 8 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import "git.milar.in/milarin/anilist"
type ParsedTorrent struct {
Torrent *Torrent
Anime *anilist.Media
Name string
Title string
Episode int
Languages []string
Resolution

View File

@ -8,11 +8,12 @@ import (
type Resolution int
const (
Resolution4K Resolution = 2160
ResolutionQuadHD Resolution = 1440
ResolutionFullHD Resolution = 1080
ResolutionHD Resolution = 720
ResolutionSD Resolution = 480
Resolution4K Resolution = 2160
ResolutionQuadHD Resolution = 1440
ResolutionFullHD Resolution = 1080
ResolutionHD Resolution = 720
ResolutionSD Resolution = 480
ResolutionUnknown Resolution = 0
)
@ -25,7 +26,7 @@ func ParseResolution(str string) (Resolution, error) {
case "SD":
return ResolutionSD, nil
default:
v, err := strconv.Atoi(str)
v, err := strconv.Atoi(strings.TrimSuffix(str, "p"))
return Resolution(v), err
}
}