comparison include/core/anime_db.h @ 319:d928ec7b6a0d

services/kitsu: implement GetAnimeList() it finally works!
author Paper <paper@paper.us.eu.org>
date Wed, 12 Jun 2024 17:52:26 -0400
parents b1f4d1867ab1
children 10096c5489e3
comparison
equal deleted inserted replaced
318:3b355fa948c7 319:d928ec7b6a0d
9 namespace Anime { 9 namespace Anime {
10 10
11 class Database { 11 class Database {
12 public: 12 public:
13 std::unordered_map<int, Anime> items; 13 std::unordered_map<int, Anime> items;
14 size_t GetTotalAnimeAmount(); 14 size_t GetTotalAnimeAmount() const;
15 size_t GetTotalEpisodeAmount(); 15 size_t GetTotalEpisodeAmount() const;
16 size_t GetTotalWatchedAmount(); 16 size_t GetTotalWatchedAmount() const;
17 size_t GetTotalPlannedAmount(); 17 size_t GetTotalPlannedAmount() const;
18 double GetAverageScore(); 18 double GetAverageScore() const;
19 double GetScoreDeviation(); 19 double GetScoreDeviation() const;
20 size_t GetListsAnimeAmount(ListStatus status); 20 size_t GetListsAnimeAmount(ListStatus status) const;
21 int GetAnimeFromTitle(const std::string& title); 21 int LookupAnimeTitle(const std::string& title) const;
22 22
23 bool GetDatabaseAsJSON(nlohmann::json& json); 23 bool GetDatabaseAsJSON(nlohmann::json& json) const;
24 bool SaveDatabaseToDisk(); 24 bool SaveDatabaseToDisk() const;
25 25
26 bool ParseDatabaseJSON(const nlohmann::json& json); 26 bool ParseDatabaseJSON(const nlohmann::json& json);
27 bool LoadDatabaseFromDisk(); 27 bool LoadDatabaseFromDisk();
28 28
29 /* These are here to make sure that our service IDs don't collide 29 /* These are here to make sure that our service IDs don't collide
30 * and make the whole thing go boom. */ 30 * and make the whole thing go boom. */
31 int GetUnusedId(); 31 int GetUnusedId() const;
32 int LookupServiceId(Service service, const std::string& id_to_find); 32 int LookupServiceId(Service service, const std::string& id_to_find) const;
33 int LookupServiceIdOrUnused(Service service, const std::string& id_to_find); 33 int LookupServiceIdOrUnused(Service service, const std::string& id_to_find) const;
34
35 /* when syncing we don't want to keep deleted anime */
36 void RemoveAllUserData();
34 }; 37 };
35 38
36 extern Database db; 39 extern Database db;
37 40
38 } // namespace Anime 41 } // namespace Anime