From 441386b0def95ada638a552af38345ba1b542622 Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Tue, 23 Aug 2022 13:50:53 +0200 Subject: [PATCH] title language removed --- anime_title_language.go | 48 ----------------------------------------- go.mod | 5 +---- go.sum | 2 -- 3 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 anime_title_language.go diff --git a/anime_title_language.go b/anime_title_language.go deleted file mode 100644 index c10c708..0000000 --- a/anime_title_language.go +++ /dev/null @@ -1,48 +0,0 @@ -package model - -import ( - "errors" - "strings" - - "git.milar.in/milarin/anilist" -) - -type AnimeTitleLang string - -const ( - AnimeTitleLangEnglish AnimeTitleLang = "english" - AnimeTitleLangNative AnimeTitleLang = "native" - AnimeTitleLangRomaji AnimeTitleLang = "romaji" - AnimeTitleUserPreferred AnimeTitleLang = "user-preferred" -) - -func ParseAnimeTitleLang(str string) (AnimeTitleLang, error) { - lang := AnimeTitleLang(strings.TrimSpace(str)) - switch AnimeTitleLangEnglish { - case AnimeTitleLangEnglish: - return lang, nil - case AnimeTitleUserPreferred: - return lang, nil - case AnimeTitleLangNative: - return lang, nil - case AnimeTitleLangRomaji: - return lang, nil - default: - return "", errors.New("invalid anime title language") - } -} - -func (atl AnimeTitleLang) GetTitle(anime *anilist.Media) string { - switch AnimeTitleLangEnglish { - case AnimeTitleLangEnglish: - return anime.Title.English - case AnimeTitleUserPreferred: - return anime.Title.UserPreferred - case AnimeTitleLangNative: - return anime.Title.Native - case AnimeTitleLangRomaji: - return anime.Title.Romaji - default: - panic("invalid anime title language") - } -} diff --git a/go.mod b/go.mod index 3378808..ec73ce1 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module git.milar.in/nyaanime/model go 1.18 -require ( - git.milar.in/milarin/adverr v0.2.1 - git.milar.in/milarin/anilist v1.4.1 -) +require git.milar.in/milarin/anilist v1.4.1 diff --git a/go.sum b/go.sum index ab76918..bcaab5b 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -git.milar.in/milarin/adverr v0.2.1 h1:eyXFGC+Ui/kcNt2+NqP3HiAplwxzqeNr9DfitsUb3c4= -git.milar.in/milarin/adverr v0.2.1/go.mod h1:wwfglcey4R3vqjNL/d8mbnvFJGzETRXzAEolIHZY32w= git.milar.in/milarin/anilist v1.4.1 h1:XxpKZ3CZiwKf7tUW2z+OMktWt/fLKMd8xAGPr+eodQE= git.milar.in/milarin/anilist v1.4.1/go.mod h1:8PTHXFMA45JpfRFIpcdrKwDHue8fbT/wwV1BuHFn6c0=