Mercurial > minori
annotate src/gui/translate/anilist.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | 9613d72b097e |
children | 657fda1b9cac |
rev | line source |
---|---|
15 | 1 #include "gui/translate/anilist.h" |
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
2 #include <unordered_map> |
15 | 3 |
63 | 4 namespace Translate { |
5 namespace AniList { | |
15 | 6 |
7 Anime::SeriesStatus ToSeriesStatus(std::string status) { | |
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
8 static const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
15 | 9 {"FINISHED", Anime::SeriesStatus::FINISHED }, |
10 {"RELEASING", Anime::SeriesStatus::RELEASING }, | |
11 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, | |
12 {"CANCELLED", Anime::SeriesStatus::CANCELLED }, | |
13 {"HIATUS", Anime::SeriesStatus::HIATUS } | |
14 }; | |
15 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
16 if (map.find(status) == map.end()) |
15 | 17 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
|
18 return map.at(status); |
15 | 19 } |
20 | |
21 Anime::SeriesSeason ToSeriesSeason(std::string season) { | |
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
22 static const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
15 | 23 {"WINTER", Anime::SeriesSeason::WINTER}, |
24 {"SPRING", Anime::SeriesSeason::SPRING}, | |
25 {"SUMMER", Anime::SeriesSeason::SUMMER}, | |
26 {"FALL", Anime::SeriesSeason::FALL } | |
27 }; | |
28 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
29 if (map.find(season) == map.end()) |
15 | 30 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
|
31 return map.at(season); |
15 | 32 } |
33 | |
34 Anime::SeriesFormat ToSeriesFormat(std::string format) { | |
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
35 static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { |
15 | 36 {"TV", Anime::SeriesFormat::TV }, |
37 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, | |
38 {"MOVIE", Anime::SeriesFormat::MOVIE }, | |
39 {"SPECIAL", Anime::SeriesFormat::SPECIAL }, | |
40 {"OVA", Anime::SeriesFormat::OVA }, | |
41 {"ONA", Anime::SeriesFormat::ONA }, | |
42 {"MUSIC", Anime::SeriesFormat::MUSIC }, | |
43 {"MANGA", Anime::SeriesFormat::MANGA }, | |
44 {"NOVEL", Anime::SeriesFormat::NOVEL }, | |
45 {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT} | |
46 }; | |
47 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
48 if (map.find(format) == map.end()) |
15 | 49 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
|
50 return map.at(format); |
15 | 51 } |
52 | |
63 | 53 } // namespace AniList |
54 } // namespace Translate |