diff --git a/integrations/animeschedule/animeschedule.go b/integrations/animeschedule/animeschedule.go index aa2a489..f6eb549 100644 --- a/integrations/animeschedule/animeschedule.go +++ b/integrations/animeschedule/animeschedule.go @@ -239,15 +239,8 @@ func parseMeta(meta string) (episodeText string, localTime string, airType AirTy } localTime = strings.TrimSpace(parts[timeIdx] + " " + parts[timeIdx+1]) - typeRaw := strings.TrimSpace(parts[timeIdx+2]) - switch strings.ToUpper(typeRaw) { - case "JPN": - airType = AirTypeJPN - case "SUB": - airType = AirTypeSUB - case "DUB": - airType = AirTypeDUB - default: + airType, ok := parseAirType(parts[timeIdx+2]) + if !ok { return "", "", "" } @@ -255,6 +248,19 @@ func parseMeta(meta string) (episodeText string, localTime string, airType AirTy return episodeText, localTime, airType } +func parseAirType(raw string) (AirType, bool) { + switch strings.ToUpper(strings.TrimSpace(raw)) { + case "JPN": + return AirTypeJPN, true + case "SUB": + return AirTypeSUB, true + case "DUB": + return AirTypeDUB, true + default: + return "", false + } +} + func preferredReleaseEntries(entries []Entry) []Entry { type keyedEntry struct { index int