Mercurial > minori
comparison src/gui/translate/anilist.cpp @ 15:cde8f67a7c7d
*: update, megacommit :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 19 Sep 2023 22:36:08 -0400 |
parents | |
children | d0adc4aedfc8 |
comparison
equal
deleted
inserted
replaced
14:a29c9402faf0 | 15:cde8f67a7c7d |
---|---|
1 #include "gui/translate/anilist.h" | |
2 | |
3 namespace Translate::AniList { | |
4 | |
5 Anime::SeriesStatus ToSeriesStatus(std::string status) { | |
6 std::unordered_map<std::string, Anime::SeriesStatus> map = { | |
7 {"FINISHED", Anime::SeriesStatus::FINISHED }, | |
8 {"RELEASING", Anime::SeriesStatus::RELEASING }, | |
9 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, | |
10 {"CANCELLED", Anime::SeriesStatus::CANCELLED }, | |
11 {"HIATUS", Anime::SeriesStatus::HIATUS } | |
12 }; | |
13 | |
14 if (!map.contains(status)) | |
15 return Anime::SeriesStatus::UNKNOWN; | |
16 return map[status]; | |
17 } | |
18 | |
19 Anime::SeriesSeason ToSeriesSeason(std::string season) { | |
20 std::unordered_map<std::string, Anime::SeriesSeason> map = { | |
21 {"WINTER", Anime::SeriesSeason::WINTER}, | |
22 {"SPRING", Anime::SeriesSeason::SPRING}, | |
23 {"SUMMER", Anime::SeriesSeason::SUMMER}, | |
24 {"FALL", Anime::SeriesSeason::FALL } | |
25 }; | |
26 | |
27 if (!map.contains(season)) | |
28 return Anime::SeriesSeason::UNKNOWN; | |
29 return map[season]; | |
30 } | |
31 | |
32 Anime::SeriesFormat ToSeriesFormat(std::string format) { | |
33 std::unordered_map<std::string, enum Anime::SeriesFormat> map = { | |
34 {"TV", Anime::SeriesFormat::TV }, | |
35 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, | |
36 {"MOVIE", Anime::SeriesFormat::MOVIE }, | |
37 {"SPECIAL", Anime::SeriesFormat::SPECIAL }, | |
38 {"OVA", Anime::SeriesFormat::OVA }, | |
39 {"ONA", Anime::SeriesFormat::ONA }, | |
40 {"MUSIC", Anime::SeriesFormat::MUSIC }, | |
41 {"MANGA", Anime::SeriesFormat::MANGA }, | |
42 {"NOVEL", Anime::SeriesFormat::NOVEL }, | |
43 {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT} | |
44 }; | |
45 | |
46 if (!map.contains(format)) | |
47 return Anime::SeriesFormat::UNKNOWN; | |
48 return map[format]; | |
49 } | |
50 | |
51 } // namespace Translate::AniList |