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 { type ParsedTorrent struct {
Torrent *Torrent Torrent *Torrent
Anime *anilist.Media Anime *anilist.Media
Name string Title string
Episode int Episode int
Languages []string Languages []string
Resolution Resolution

View File

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