annotate src/services/services.cc @ 308:da2c5a8ff306

time: don't use time_t!
author Paper <paper@paper.us.eu.org>
date Tue, 11 Jun 2024 04:24:19 -0400
parents 2115488eb302
children b1f4d1867ab1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
1 #include "services/services.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
2 #include "core/session.h"
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 52
diff changeset
3 #include "gui/dialog/settings.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
4 #include "services/anilist.h"
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
5
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
6 namespace Services {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
7
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
8 void Synchronize() {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
9 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
10 case Anime::Service::AniList: AniList::GetAnimeList(); break;
112
80f49f623d30 locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
11 default: break;
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
12 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
13 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
14
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
15 std::vector<int> Search(const std::string& search) {
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
16 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
17 case Anime::Service::AniList: return AniList::Search(search);
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
18 default: return {};
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
19 }
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
20 }
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
21
304
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
22 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) {
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
23 switch (session.config.service) {
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
24 case Anime::Service::AniList: return AniList::GetSeason(season, year);
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
25 default: return {};
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
26 }
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
27 }
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
28
52
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
29 void UpdateAnimeEntry(int id) {
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
30 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
31 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;
52
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
32 default: break;
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
33 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
34 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
35
44
619cbd6e69f9 filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
36 bool Authorize() {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
37 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
38 case Anime::Service::AniList: return AniList::AuthorizeUser();
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 52
diff changeset
39 default: return true;
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
40 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
41 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
42
44
619cbd6e69f9 filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
43 }; // namespace Services