Mercurial > minori
annotate src/gui/translate/anilist.cc @ 137:69db40272acd
dep/animia: [WIP] huge refactor
this WILL NOT compile, because lots of code has been changed
and every API in the original codebase has been removed.
note that this api setup is not exactly permanent...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 10 Nov 2023 13:52:47 -0500 |
parents | 9b2b41f83a5e |
children | 9613d72b097e |
rev | line source |
---|---|
15 | 1 #include "gui/translate/anilist.h" |
2 | |
63 | 3 namespace Translate { |
4 namespace AniList { | |
15 | 5 |
6 Anime::SeriesStatus ToSeriesStatus(std::string status) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
7 const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
15 | 8 {"FINISHED", Anime::SeriesStatus::FINISHED }, |
9 {"RELEASING", Anime::SeriesStatus::RELEASING }, | |
10 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, | |
11 {"CANCELLED", Anime::SeriesStatus::CANCELLED }, | |
12 {"HIATUS", Anime::SeriesStatus::HIATUS } | |
13 }; | |
14 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
15 if (map.find(status) == map.end()) |
15 | 16 return Anime::SeriesStatus::UNKNOWN; |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
17 return map.at(status); |
15 | 18 } |
19 | |
20 Anime::SeriesSeason ToSeriesSeason(std::string season) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
21 const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
15 | 22 {"WINTER", Anime::SeriesSeason::WINTER}, |
23 {"SPRING", Anime::SeriesSeason::SPRING}, | |
24 {"SUMMER", Anime::SeriesSeason::SUMMER}, | |
25 {"FALL", Anime::SeriesSeason::FALL } | |
26 }; | |
27 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
28 if (map.find(season) == map.end()) |
15 | 29 return Anime::SeriesSeason::UNKNOWN; |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
30 return map.at(season); |
15 | 31 } |
32 | |
33 Anime::SeriesFormat ToSeriesFormat(std::string format) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
34 const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { |
15 | 35 {"TV", Anime::SeriesFormat::TV }, |
36 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, | |
37 {"MOVIE", Anime::SeriesFormat::MOVIE }, | |
38 {"SPECIAL", Anime::SeriesFormat::SPECIAL }, | |
39 {"OVA", Anime::SeriesFormat::OVA }, | |
40 {"ONA", Anime::SeriesFormat::ONA }, | |
41 {"MUSIC", Anime::SeriesFormat::MUSIC }, | |
42 {"MANGA", Anime::SeriesFormat::MANGA }, | |
43 {"NOVEL", Anime::SeriesFormat::NOVEL }, | |
44 {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT} | |
45 }; | |
46 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
47 if (map.find(format) == map.end()) |
15 | 48 return Anime::SeriesFormat::UNKNOWN; |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
49 return map.at(format); |
15 | 50 } |
51 | |
63 | 52 } // namespace AniList |
53 } // namespace Translate |