annotate src/services/services.cc @ 337:a7d4e5107531

dep/animone: REFACTOR ALL THE THINGS 1: animone now has its own syntax divergent from anisthesia, making different platforms actually have their own sections 2: process names in animone are now called `comm' (this will probably break things). this is what its called in bsd/linux so I'm just going to use it everywhere 3: the X11 code now checks for the existence of a UTF-8 window title and passes it if available 4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK! I still actually need to test the bsd code. to be honest I'm probably going to move all of the bsds into separate files because they're all essentially different operating systems at this point
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 12:51:15 -0400
parents 948955c3ba81
children
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"
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
3 #include "core/strings.h"
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
4 #include "gui/translate/anime.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
5 #include "services/anilist.h"
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 304
diff changeset
6 #include "services/kitsu.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
7
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
8 #include <fmt/core.h>
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
9
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
10 namespace Services {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
11
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
12 void Synchronize() {
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
13 session.SetStatusBar(fmt::format(Strings::Translate("{}: Retrieving anime list..."), Translate::ToString(session.config.service)));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
14
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
15 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
16 case Anime::Service::AniList: AniList::GetAnimeList(); break;
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 304
diff changeset
17 case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break;
112
80f49f623d30 locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
18 default: break;
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
19 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
20 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
21
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
22 bool RetrieveAnimeMetadata(int id) {
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
23 switch (session.config.service) {
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
24 case Anime::Service::Kitsu: return Kitsu::RetrieveAnimeMetadata(id);
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
25 default: return false;
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
26 }
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
27 }
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
28
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
29 std::vector<int> Search(const std::string& search) {
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
30 session.SetStatusBar(fmt::format(Strings::Translate("{}: Requesting search query..."), Translate::ToString(session.config.service)));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
31
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
32 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
33 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
34 case Anime::Service::Kitsu: return Kitsu::Search(search);
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
35 default: return {};
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
36 }
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
37 }
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 112
diff changeset
38
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 325
diff changeset
39 bool GetSeason(Anime::Season season) {
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
40 session.SetStatusBar(fmt::format(Strings::Translate("{}: Retrieving anime season data..."), Translate::ToString(session.config.service)));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
41
304
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
42 switch (session.config.service) {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 325
diff changeset
43 case Anime::Service::AniList: return AniList::GetSeason(season);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 325
diff changeset
44 case Anime::Service::Kitsu: return Kitsu::GetSeason(season);
304
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
45 default: return {};
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
46 }
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
47 }
2115488eb302 *: add very early season searcher
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
48
52
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
49 void UpdateAnimeEntry(int id) {
334
948955c3ba81 services: use fmt for setting the status bar
Paper <paper@paper.us.eu.org>
parents: 327
diff changeset
50 session.SetStatusBar(fmt::format(Strings::Translate("{}: Updating remote anime entry..."), Translate::ToString(session.config.service)));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
51
52
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
52 switch (session.config.service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
53 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
54 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
55 default: break;
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
56 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
57 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
58
44
619cbd6e69f9 filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
59 }; // namespace Services