Mercurial > minori
annotate src/gui/translate/anilist.cc @ 280:9b6e12c14a1e
chore: merge
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Mon, 06 May 2024 17:23:30 -0400 |
| parents | 657fda1b9cac |
| children | b1f625b0227c |
| 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 |
| 279 | 7 Anime::SeriesStatus ToSeriesStatus(const 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 = { |
| 279 | 9 {"FINISHED", Anime::SeriesStatus::Finished }, |
| 10 {"RELEASING", Anime::SeriesStatus::Releasing }, | |
| 11 {"NOT_YET_RELEASED", Anime::SeriesStatus::NotYetReleased}, | |
| 12 {"CANCELLED", Anime::SeriesStatus::Cancelled }, | |
| 13 {"HIATUS", Anime::SeriesStatus::Hiatus } | |
| 15 | 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()) |
| 279 | 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 | |
| 279 | 21 Anime::SeriesSeason ToSeriesSeason(const 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 = { |
| 279 | 23 {"WINTER", Anime::SeriesSeason::Winter}, |
| 24 {"SPRING", Anime::SeriesSeason::Spring}, | |
| 25 {"SUMMER", Anime::SeriesSeason::Summer}, | |
| 26 {"FALL", Anime::SeriesSeason::Fall } | |
| 15 | 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()) |
| 279 | 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 | |
| 279 | 34 Anime::SeriesFormat ToSeriesFormat(const 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 = { |
| 279 | 36 {"TV", Anime::SeriesFormat::Tv }, |
| 37 {"TV_SHORT", Anime::SeriesFormat::TvShort}, | |
| 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 } | |
| 15 | 43 }; |
| 44 | |
|
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
45 if (map.find(format) == map.end()) |
| 279 | 46 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
|
47 return map.at(format); |
| 15 | 48 } |
| 49 | |
| 63 | 50 } // namespace AniList |
| 51 } // namespace Translate |
