Mercurial > minori
annotate src/services/services.cc @ 318:3b355fa948c7
config: use TOML instead of INI
unfortunately, INI is not enough, and causes some paths including
semicolons to break with our current storage of the library folders.
so, I decided to switch to TOML which does support real arrays...
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 05:25:41 -0400 |
parents | b1f4d1867ab1 |
children | 1b5c04268d6a |
rev | line source |
---|---|
15 | 1 #include "services/services.h" |
10 | 2 #include "core/session.h" |
3 #include "services/anilist.h" | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
304
diff
changeset
|
4 #include "services/kitsu.h" |
10 | 5 |
6 namespace Services { | |
7 | |
8 void Synchronize() { | |
9 switch (session.config.service) { | |
279 | 10 case Anime::Service::AniList: AniList::GetAnimeList(); break; |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
304
diff
changeset
|
11 case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; |
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
12 default: break; |
10 | 13 } |
14 } | |
15 | |
250 | 16 std::vector<int> Search(const std::string& search) { |
17 switch (session.config.service) { | |
279 | 18 case Anime::Service::AniList: return AniList::Search(search); |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
304
diff
changeset
|
19 case Anime::Service::Kitsu: return Kitsu::Search(search); |
250 | 20 default: return {}; |
21 } | |
22 } | |
23 | |
304
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
24 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
|
25 switch (session.config.service) { |
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
26 case Anime::Service::AniList: return AniList::GetSeason(season, year); |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
304
diff
changeset
|
27 case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year); |
304
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
28 default: return {}; |
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
29 } |
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
30 } |
2115488eb302
*: add very early season searcher
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
31 |
52
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
32 void UpdateAnimeEntry(int id) { |
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
33 switch (session.config.service) { |
279 | 34 case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
304
diff
changeset
|
35 case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; |
52
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
36 default: break; |
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
37 } |
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
38 } |
0c4138de2ea7
anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents:
47
diff
changeset
|
39 |
44
619cbd6e69f9
filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
40 }; // namespace Services |