Mercurial > minori
comparison src/services/services.cc @ 320:1b5c04268d6a
services/kitsu: ACTUALLY finish GetAnimeList
there are some things the API just... doesn't provide. therefore
we have to request the genres separately any time a new anime info
box is opened...
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 19:49:19 -0400 |
parents | b1f4d1867ab1 |
children | 78929794e7d8 |
comparison
equal
deleted
inserted
replaced
319:d928ec7b6a0d | 320:1b5c04268d6a |
---|---|
1 #include "services/services.h" | 1 #include "services/services.h" |
2 #include "core/session.h" | 2 #include "core/session.h" |
3 #include "gui/translate/anime.h" | |
3 #include "services/anilist.h" | 4 #include "services/anilist.h" |
4 #include "services/kitsu.h" | 5 #include "services/kitsu.h" |
5 | 6 |
6 namespace Services { | 7 namespace Services { |
7 | 8 |
8 void Synchronize() { | 9 void Synchronize() { |
10 session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime list..."); | |
11 | |
9 switch (session.config.service) { | 12 switch (session.config.service) { |
10 case Anime::Service::AniList: AniList::GetAnimeList(); break; | 13 case Anime::Service::AniList: AniList::GetAnimeList(); break; |
11 case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; | 14 case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; |
12 default: break; | 15 default: break; |
13 } | 16 } |
14 } | 17 } |
15 | 18 |
19 bool RetrieveAnimeMetadata(int id) { | |
20 switch (session.config.service) { | |
21 case Anime::Service::Kitsu: return Kitsu::RetrieveAnimeMetadata(id); | |
22 default: return false; | |
23 } | |
24 } | |
25 | |
16 std::vector<int> Search(const std::string& search) { | 26 std::vector<int> Search(const std::string& search) { |
27 session.SetStatusBar(Translate::ToString(session.config.service) + ": Requesting search query..."); | |
28 | |
17 switch (session.config.service) { | 29 switch (session.config.service) { |
18 case Anime::Service::AniList: return AniList::Search(search); | 30 case Anime::Service::AniList: return AniList::Search(search); |
19 case Anime::Service::Kitsu: return Kitsu::Search(search); | 31 case Anime::Service::Kitsu: return Kitsu::Search(search); |
20 default: return {}; | 32 default: return {}; |
21 } | 33 } |
22 } | 34 } |
23 | 35 |
24 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) { | 36 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) { |
37 session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime season data..."); | |
38 | |
25 switch (session.config.service) { | 39 switch (session.config.service) { |
26 case Anime::Service::AniList: return AniList::GetSeason(season, year); | 40 case Anime::Service::AniList: return AniList::GetSeason(season, year); |
27 case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year); | 41 case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year); |
28 default: return {}; | 42 default: return {}; |
29 } | 43 } |
30 } | 44 } |
31 | 45 |
32 void UpdateAnimeEntry(int id) { | 46 void UpdateAnimeEntry(int id) { |
47 session.SetStatusBar(Translate::ToString(session.config.service) + ": Updating remote anime entry..."); | |
48 | |
33 switch (session.config.service) { | 49 switch (session.config.service) { |
34 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; | 50 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; |
35 case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; | 51 case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; |
36 default: break; | 52 default: break; |
37 } | 53 } |