annotate src/gui/translate/anilist.cpp @ 29:42145ef90a48

ci/win32: Fix permissions
author Paper <mrpapersonic@gmail.com>
date Wed, 20 Sep 2023 00:47:02 -0400
parents cde8f67a7c7d
children d0adc4aedfc8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "gui/translate/anilist.h"
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 namespace Translate::AniList {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 Anime::SeriesStatus ToSeriesStatus(std::string status) {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 std::unordered_map<std::string, Anime::SeriesStatus> map = {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 {"FINISHED", Anime::SeriesStatus::FINISHED },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 {"RELEASING", Anime::SeriesStatus::RELEASING },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 {"CANCELLED", Anime::SeriesStatus::CANCELLED },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 {"HIATUS", Anime::SeriesStatus::HIATUS }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 if (!map.contains(status))
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 return Anime::SeriesStatus::UNKNOWN;
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 return map[status];
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 Anime::SeriesSeason ToSeriesSeason(std::string season) {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 std::unordered_map<std::string, Anime::SeriesSeason> map = {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 {"WINTER", Anime::SeriesSeason::WINTER},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 {"SPRING", Anime::SeriesSeason::SPRING},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 {"SUMMER", Anime::SeriesSeason::SUMMER},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 {"FALL", Anime::SeriesSeason::FALL }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 if (!map.contains(season))
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 return Anime::SeriesSeason::UNKNOWN;
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 return map[season];
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 Anime::SeriesFormat ToSeriesFormat(std::string format) {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 std::unordered_map<std::string, enum Anime::SeriesFormat> map = {
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 {"TV", Anime::SeriesFormat::TV },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 {"MOVIE", Anime::SeriesFormat::MOVIE },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 {"SPECIAL", Anime::SeriesFormat::SPECIAL },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 {"OVA", Anime::SeriesFormat::OVA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 {"ONA", Anime::SeriesFormat::ONA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 {"MUSIC", Anime::SeriesFormat::MUSIC },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 {"MANGA", Anime::SeriesFormat::MANGA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 {"NOVEL", Anime::SeriesFormat::NOVEL },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT}
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 if (!map.contains(format))
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47 return Anime::SeriesFormat::UNKNOWN;
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48 return map[format];
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 } // namespace Translate::AniList