Better strconv error for title, and checking for non-1080p HEVC
This commit is contained in:
parent
41cff42d3a
commit
7beae1b849
15
main.go
15
main.go
@ -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 {
|
||||
title = strings.Split(title, " [1080p]")[0]
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user