Better strconv error for title, and checking for non-1080p HEVC

This commit is contained in:
Kenneth Jao 2024-10-02 13:38:35 -04:00
parent 41cff42d3a
commit 7beae1b849

13
main.go
View File

@ -96,6 +96,9 @@ func (ani *Anime) InfoFromTitle(title string) error {
epInfo := strings.Split(titleSplit[len(titleSplit)-1], "v")
ep, err := strconv.Atoi(epInfo[0])
if err != nil {
err = fmt.Errorf("%w. Full string: %v", err, title)
}
return e.If(err).ThenIf(func() error {
ani.Episode = ep
if len(epInfo) > 1 {
@ -229,7 +232,17 @@ func GetAllAvailable(name string, onlyHEVC bool) ([]Anime, error) {
} else if strings.Contains(title, "(Repack)") {
title = strings.Split(title, " (Repack)")[0]
} else {
is720 := strings.Contains(title, "[720p]")
is1080 := strings.Contains(title, "[1080p]")
if is720 {
title = strings.Split(title, " [720p]")[0]
} else if is1080 {
title = strings.Split(title, " [1080p]")[0]
} else {
e.Log(fmt.Sprintf("Episode not found, or processed incorrectly. Got: %s.", title), LogNTFY())
}
}
cols = cols.Next() // Download link