feat: Anilist support

This commit is contained in:
Gabe Farrell 2025-04-04 20:54:47 -04:00
parent ec6c1cc0e0
commit cdd7b67003
8 changed files with 541 additions and 143 deletions

30
helpers.go Normal file
View file

@ -0,0 +1,30 @@
package main
import (
"net/url"
"strconv"
)
// parses the boolean param "name" from url.Values "values"
func parseBoolParam(values url.Values, name string) bool {
param := values.Get(name)
if param != "" {
val, err := strconv.ParseBool(param)
if err == nil {
return val
}
} else if _, exists := values[name]; exists {
return true
}
return false
}
// just the title, or "title a.k.a. english title" if both exist
func FullAnimeTitle(title, engtitle string) string {
if engtitle != "" {
return title + " a.k.a. " + engtitle
} else {
return title
}
}