Mercurial > minori
annotate src/gui/translate/anilist.cpp @ 47:d8eb763e6661
information.cpp: add widgets to the list tab, and add an
"optional date" widget like taiga has so users can specify whether to
set the date or not
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 25 Sep 2023 00:43:38 -0400 |
parents | d0adc4aedfc8 |
children | 3d2decf093bb |
rev | line source |
---|---|
15 | 1 #include "gui/translate/anilist.h" |
2 | |
3 namespace Translate::AniList { | |
4 | |
5 Anime::SeriesStatus ToSeriesStatus(std::string status) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
6 const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
15 | 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 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
14 if (map.find(status) == map.end()) |
15 | 15 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
|
16 return map.at(status); |
15 | 17 } |
18 | |
19 Anime::SeriesSeason ToSeriesSeason(std::string season) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
20 const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
15 | 21 {"WINTER", Anime::SeriesSeason::WINTER}, |
22 {"SPRING", Anime::SeriesSeason::SPRING}, | |
23 {"SUMMER", Anime::SeriesSeason::SUMMER}, | |
24 {"FALL", Anime::SeriesSeason::FALL } | |
25 }; | |
26 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
27 if (map.find(season) == map.end()) |
15 | 28 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
|
29 return map.at(season); |
15 | 30 } |
31 | |
32 Anime::SeriesFormat ToSeriesFormat(std::string format) { | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
33 const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { |
15 | 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 | |
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
46 if (map.find(format) == map.end()) |
15 | 47 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
|
48 return map.at(format); |
15 | 49 } |
50 | |
46 | 51 } // namespace Translate::AniList |