Mercurial > minori
annotate src/gui/translate/anilist.cc @ 223:84e0a3c4737a
library: implement menu bar buttons
I also went ahead and put the links from Taiga in so I don't have to
worry about it later...
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Mon, 08 Jan 2024 16:54:16 -0500 |
| 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 |
