comparison src/gui/translate/anilist.cc @ 202:71832ffe425a

animia: re-add kvm fd source this is all being merged from my wildly out-of-date laptop. SORRY! in other news, I edited the CI file to install the wayland client as well, so the linux CI build might finally get wayland stuff.
author Paper <paper@paper.us.eu.org>
date Tue, 02 Jan 2024 06:05:06 -0500
parents 9613d72b097e
children 657fda1b9cac
comparison
equal deleted inserted replaced
201:8f6f8dd2eb23 202:71832ffe425a
1 #include "gui/translate/anilist.h" 1 #include "gui/translate/anilist.h"
2 #include <unordered_map>
2 3
3 namespace Translate { 4 namespace Translate {
4 namespace AniList { 5 namespace AniList {
5 6
6 Anime::SeriesStatus ToSeriesStatus(std::string status) { 7 Anime::SeriesStatus ToSeriesStatus(std::string status) {
7 const std::unordered_map<std::string, Anime::SeriesStatus> map = { 8 static const std::unordered_map<std::string, Anime::SeriesStatus> map = {
8 {"FINISHED", Anime::SeriesStatus::FINISHED }, 9 {"FINISHED", Anime::SeriesStatus::FINISHED },
9 {"RELEASING", Anime::SeriesStatus::RELEASING }, 10 {"RELEASING", Anime::SeriesStatus::RELEASING },
10 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, 11 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED},
11 {"CANCELLED", Anime::SeriesStatus::CANCELLED }, 12 {"CANCELLED", Anime::SeriesStatus::CANCELLED },
12 {"HIATUS", Anime::SeriesStatus::HIATUS } 13 {"HIATUS", Anime::SeriesStatus::HIATUS }
16 return Anime::SeriesStatus::UNKNOWN; 17 return Anime::SeriesStatus::UNKNOWN;
17 return map.at(status); 18 return map.at(status);
18 } 19 }
19 20
20 Anime::SeriesSeason ToSeriesSeason(std::string season) { 21 Anime::SeriesSeason ToSeriesSeason(std::string season) {
21 const std::unordered_map<std::string, Anime::SeriesSeason> map = { 22 static const std::unordered_map<std::string, Anime::SeriesSeason> map = {
22 {"WINTER", Anime::SeriesSeason::WINTER}, 23 {"WINTER", Anime::SeriesSeason::WINTER},
23 {"SPRING", Anime::SeriesSeason::SPRING}, 24 {"SPRING", Anime::SeriesSeason::SPRING},
24 {"SUMMER", Anime::SeriesSeason::SUMMER}, 25 {"SUMMER", Anime::SeriesSeason::SUMMER},
25 {"FALL", Anime::SeriesSeason::FALL } 26 {"FALL", Anime::SeriesSeason::FALL }
26 }; 27 };
29 return Anime::SeriesSeason::UNKNOWN; 30 return Anime::SeriesSeason::UNKNOWN;
30 return map.at(season); 31 return map.at(season);
31 } 32 }
32 33
33 Anime::SeriesFormat ToSeriesFormat(std::string format) { 34 Anime::SeriesFormat ToSeriesFormat(std::string format) {
34 const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { 35 static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = {
35 {"TV", Anime::SeriesFormat::TV }, 36 {"TV", Anime::SeriesFormat::TV },
36 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, 37 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT},
37 {"MOVIE", Anime::SeriesFormat::MOVIE }, 38 {"MOVIE", Anime::SeriesFormat::MOVIE },
38 {"SPECIAL", Anime::SeriesFormat::SPECIAL }, 39 {"SPECIAL", Anime::SeriesFormat::SPECIAL },
39 {"OVA", Anime::SeriesFormat::OVA }, 40 {"OVA", Anime::SeriesFormat::OVA },