Mercurial > minori
comparison src/services/services.cc @ 317:b1f4d1867ab1
services: VERY initial Kitsu support
it only supports user authentication for now, but it's definitely
a start.
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 04:07:10 -0400 |
parents | 2115488eb302 |
children | 1b5c04268d6a |
comparison
equal
deleted
inserted
replaced
316:180714442770 | 317:b1f4d1867ab1 |
---|---|
1 #include "services/services.h" | 1 #include "services/services.h" |
2 #include "core/session.h" | 2 #include "core/session.h" |
3 #include "gui/dialog/settings.h" | |
4 #include "services/anilist.h" | 3 #include "services/anilist.h" |
4 #include "services/kitsu.h" | |
5 | 5 |
6 namespace Services { | 6 namespace Services { |
7 | 7 |
8 void Synchronize() { | 8 void Synchronize() { |
9 switch (session.config.service) { | 9 switch (session.config.service) { |
10 case Anime::Service::AniList: AniList::GetAnimeList(); break; | 10 case Anime::Service::AniList: AniList::GetAnimeList(); break; |
11 case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; | |
11 default: break; | 12 default: break; |
12 } | 13 } |
13 } | 14 } |
14 | 15 |
15 std::vector<int> Search(const std::string& search) { | 16 std::vector<int> Search(const std::string& search) { |
16 switch (session.config.service) { | 17 switch (session.config.service) { |
17 case Anime::Service::AniList: return AniList::Search(search); | 18 case Anime::Service::AniList: return AniList::Search(search); |
19 case Anime::Service::Kitsu: return Kitsu::Search(search); | |
18 default: return {}; | 20 default: return {}; |
19 } | 21 } |
20 } | 22 } |
21 | 23 |
22 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) { | 24 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) { |
23 switch (session.config.service) { | 25 switch (session.config.service) { |
24 case Anime::Service::AniList: return AniList::GetSeason(season, year); | 26 case Anime::Service::AniList: return AniList::GetSeason(season, year); |
27 case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year); | |
25 default: return {}; | 28 default: return {}; |
26 } | 29 } |
27 } | 30 } |
28 | 31 |
29 void UpdateAnimeEntry(int id) { | 32 void UpdateAnimeEntry(int id) { |
30 switch (session.config.service) { | 33 switch (session.config.service) { |
31 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; | 34 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; |
35 case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; | |
32 default: break; | 36 default: break; |
33 } | 37 } |
34 } | 38 } |
35 | 39 |
36 bool Authorize() { | |
37 switch (session.config.service) { | |
38 case Anime::Service::AniList: return AniList::AuthorizeUser(); | |
39 default: return true; | |
40 } | |
41 } | |
42 | |
43 }; // namespace Services | 40 }; // namespace Services |