Mercurial > minori
diff src/core/anime_db.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | d14f8e0e40c3 |
children | dd211ff68b36 |
line wrap: on
line diff
--- a/src/core/anime_db.cc Sun Feb 18 16:02:14 2024 -0500 +++ b/src/core/anime_db.cc Mon Apr 01 02:43:44 2024 -0400 @@ -1,18 +1,18 @@ #include "core/anime_db.h" #include "core/anime.h" -#include "core/strings.h" +#include "core/filesystem.h" #include "core/json.h" -#include "core/filesystem.h" +#include "core/strings.h" +#include "gui/translate/anilist.h" #include "gui/translate/anime.h" -#include "gui/translate/anilist.h" #include <QDate> #include <fstream> +#include <exception> #include <iostream> -#include <exception> namespace Anime { @@ -55,8 +55,8 @@ for (const auto& [id, anime] : items) if (anime.IsInUserList()) - total += anime.GetDuration() * anime.GetUserProgress() - + anime.GetEpisodes() * anime.GetDuration() * anime.GetUserRewatchedTimes(); + total += anime.GetDuration() * anime.GetUserProgress() + + anime.GetEpisodes() * anime.GetDuration() * anime.GetUserRewatchedTimes(); return total; } @@ -122,10 +122,10 @@ return id; } -/* +/* * TODO: separate this from the anime DB, * provide *some* sort of normalization -*/ + */ int Database::GetAnimeFromTitle(const std::string& title) { if (title.empty()) return 0; @@ -252,7 +252,8 @@ 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::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, {}));