Mercurial > minori
annotate src/gui/translate/anilist.cc @ 101:c537996cf67b
*: multitude of config changes
1. theme is now configurable from the settings menu
(but you have to restart for it to apply)
2. config is now stored in an INI file, with no method of
conversion from json (this repo is private-ish anyway)
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Fri, 03 Nov 2023 14:06:02 -0400 |
| parents | 9b2b41f83a5e |
| children | 9613d72b097e |
| rev | line source |
|---|---|
| 15 | 1 #include "gui/translate/anilist.h" |
| 2 | |
| 63 | 3 namespace Translate { |
| 4 namespace AniList { | |
| 15 | 5 |
| 6 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
|
7 const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
| 15 | 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 | |
|
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
15 if (map.find(status) == map.end()) |
| 15 | 16 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
|
17 return map.at(status); |
| 15 | 18 } |
| 19 | |
| 20 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
|
21 const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
| 15 | 22 {"WINTER", Anime::SeriesSeason::WINTER}, |
| 23 {"SPRING", Anime::SeriesSeason::SPRING}, | |
| 24 {"SUMMER", Anime::SeriesSeason::SUMMER}, | |
| 25 {"FALL", Anime::SeriesSeason::FALL } | |
| 26 }; | |
| 27 | |
|
47
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
28 if (map.find(season) == map.end()) |
| 15 | 29 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
|
30 return map.at(season); |
| 15 | 31 } |
| 32 | |
| 33 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
|
34 const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { |
| 15 | 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
d8eb763e6661
information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
47 if (map.find(format) == map.end()) |
| 15 | 48 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
|
49 return map.at(format); |
| 15 | 50 } |
| 51 | |
| 63 | 52 } // namespace AniList |
| 53 } // namespace Translate |
