diff src/core/anime_db.cc @ 175:9b10175be389

dep/json: update to v3.11.3 anime/db: save anime list to database, very much untested and likely won't work as intended
author Paper <mrpapersonic@gmail.com>
date Thu, 30 Nov 2023 13:52:26 -0500
parents f88eda79c60a
children 121c2d5b321f
line wrap: on
line diff
--- a/src/core/anime_db.cc	Wed Nov 29 13:53:56 2023 -0500
+++ b/src/core/anime_db.cc	Thu Nov 30 13:52:26 2023 -0500
@@ -234,12 +234,12 @@
 		anime.AddToUserList();
 
 	anime.SetUserStatus(Translate::ToListStatus(JSON::GetString<std::string>(json, "/status"_json_pointer, "")));
-	anime.SetUserStatus(JSON::GetNumber(json, "/progress"_json_pointer, 0));
+	anime.SetUserProgress(JSON::GetNumber(json, "/progress"_json_pointer, 0));
 	anime.SetUserScore(JSON::GetNumber(json, "/score"_json_pointer, 0));
 	anime.SetUserDateStarted(Date(JSON::GetValue(json, "/started"_json_pointer)));
 	anime.SetUserDateStarted(Date(JSON::GetValue(json, "/completed"_json_pointer)));
 	anime.SetUserIsPrivate(JSON::GetBoolean(json, "/private"_json_pointer, false));
-	anime.SetUserRewatchedTimes(JSON::GetNumber(json, "/rewatched_times"_json_pointer, ""));
+	anime.SetUserRewatchedTimes(JSON::GetNumber(json, "/rewatched_times"_json_pointer, 0));
 	anime.SetUserIsRewatching(JSON::GetBoolean(json, "/rewatching"_json_pointer, false));
 	anime.SetUserTimeUpdated(JSON::GetNumber(json, "/updated"_json_pointer, 0));
 	anime.SetUserNotes(JSON::GetString<std::string>(json, "/notes"_json_pointer, ""));
@@ -260,18 +260,18 @@
 	anime.SetEnglishTitle(JSON::GetString<std::string>(json, "/title/english"_json_pointer, ""));
 	anime.SetTitleSynonyms(JSON::GetArray<std::vector<std::string>>(json, "/synonyms"_json_pointer, {}));
 	anime.SetEpisodes(JSON::GetNumber(json, "/episodes"_json_pointer, 0));
-	anime.SetAiringStatus(Translate::AniList::ToSeriesStatus(JSON::GetString<std::string>(json, "/airing_status"_json_pointer, "")));
+	anime.SetAiringStatus(Translate::ToSeriesStatus(JSON::GetString<std::string>(json, "/airing_status"_json_pointer, "")));
 	anime.SetAirDate(Date(JSON::GetValue(json, "/air_date"_json_pointer)));
 	anime.SetGenres(JSON::GetArray<std::vector<std::string>>(json, "/genres"_json_pointer, {}));
 	anime.SetProducers(JSON::GetArray<std::vector<std::string>>(json, "/producers"_json_pointer, {}));
-	anime.SetFormat(Translate::AniList::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, "")));
-	anime.SetSeason(Translate::AniList::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, "")));
+	anime.SetFormat(Translate::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, "")));
+	anime.SetSeason(Translate::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, "")));
 	anime.SetAudienceScore(JSON::GetNumber(json, "/audience_score"_json_pointer, 0));
 	anime.SetSynopsis(JSON::GetString<std::string>(json, "/synopsis"_json_pointer, ""));
 	anime.SetDuration(JSON::GetNumber(json, "/duration"_json_pointer, 0));
 	anime.SetPosterUrl(JSON::GetString<std::string>(json, "/poster_url"_json_pointer, ""));
 
-	if (json.contains("/list_data") && json.at("/list_data").is_dictionary())
+	if (json.contains("/list_data") && json.at("/list_data").is_array())
 		ParseAnimeUserInfoJSON(json, anime);
 
 	return true;