annotate src/gui/translate/anilist.cc @ 183:01d259b9c89f

pages/torrents.cc: parse feed descriptions separately services/anilist.cc: use constexpr STL string_view for HTTP queries
author Paper <mrpapersonic@gmail.com>
date Mon, 04 Dec 2023 13:40:42 -0500
parents 9b2b41f83a5e
children 9613d72b097e
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
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
3 namespace Translate {
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
4 namespace AniList {
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 {"FINISHED", Anime::SeriesStatus::FINISHED },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 {"RELEASING", Anime::SeriesStatus::RELEASING },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 {"CANCELLED", Anime::SeriesStatus::CANCELLED },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 {"HIATUS", Anime::SeriesStatus::HIATUS }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 {"WINTER", Anime::SeriesSeason::WINTER},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 {"SPRING", Anime::SeriesSeason::SPRING},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 {"SUMMER", Anime::SeriesSeason::SUMMER},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 {"FALL", Anime::SeriesSeason::FALL }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 {"TV", Anime::SeriesFormat::TV },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 {"TV_SHORT", Anime::SeriesFormat::TV_SHORT},
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 {"MOVIE", Anime::SeriesFormat::MOVIE },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 {"SPECIAL", Anime::SeriesFormat::SPECIAL },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 {"OVA", Anime::SeriesFormat::OVA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 {"ONA", Anime::SeriesFormat::ONA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 {"MUSIC", Anime::SeriesFormat::MUSIC },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 {"MANGA", Anime::SeriesFormat::MANGA },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 {"NOVEL", Anime::SeriesFormat::NOVEL },
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT}
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 };
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 }
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
52 } // namespace AniList
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
53 } // namespace Translate