mirror of
https://github.com/gabehf/sonarr-anime-importer.git
synced 2026-03-14 09:45:54 -07:00
30 lines
577 B
Go
30 lines
577 B
Go
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
|
|
}
|
|
}
|