comparison src/gui/translate/anilist.cc @ 81:9b2b41f83a5e

boring: mass rename to cc because this is a very unix-y project, it makes more sense to use the 'cc' extension
author Paper <mrpapersonic@gmail.com>
date Mon, 23 Oct 2023 12:07:27 -0400
parents src/gui/translate/anilist.cpp@3d2decf093bb
children 9613d72b097e
comparison
equal deleted inserted replaced
80:825506f0e221 81:9b2b41f83a5e
1 #include "gui/translate/anilist.h"
2
3 namespace Translate {
4 namespace AniList {
5
6 Anime::SeriesStatus ToSeriesStatus(std::string status) {
7 const std::unordered_map<std::string, Anime::SeriesStatus> map = {
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
15 if (map.find(status) == map.end())
16 return Anime::SeriesStatus::UNKNOWN;
17 return map.at(status);
18 }
19
20 Anime::SeriesSeason ToSeriesSeason(std::string season) {
21 const std::unordered_map<std::string, Anime::SeriesSeason> map = {
22 {"WINTER", Anime::SeriesSeason::WINTER},
23 {"SPRING", Anime::SeriesSeason::SPRING},
24 {"SUMMER", Anime::SeriesSeason::SUMMER},
25 {"FALL", Anime::SeriesSeason::FALL }
26 };
27
28 if (map.find(season) == map.end())
29 return Anime::SeriesSeason::UNKNOWN;
30 return map.at(season);
31 }
32
33 Anime::SeriesFormat ToSeriesFormat(std::string format) {
34 const std::unordered_map<std::string, enum Anime::SeriesFormat> map = {
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 if (map.find(format) == map.end())
48 return Anime::SeriesFormat::UNKNOWN;
49 return map.at(format);
50 }
51
52 } // namespace AniList
53 } // namespace Translate