Mercurial > minori
view src/gui/translate/anilist.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 | 9613d72b097e |
children | 657fda1b9cac |
line wrap: on
line source
#include "gui/translate/anilist.h" #include <unordered_map> namespace Translate { namespace AniList { Anime::SeriesStatus ToSeriesStatus(std::string status) { static const std::unordered_map<std::string, Anime::SeriesStatus> map = { {"FINISHED", Anime::SeriesStatus::FINISHED }, {"RELEASING", Anime::SeriesStatus::RELEASING }, {"NOT_YET_RELEASED", Anime::SeriesStatus::NOT_YET_RELEASED}, {"CANCELLED", Anime::SeriesStatus::CANCELLED }, {"HIATUS", Anime::SeriesStatus::HIATUS } }; if (map.find(status) == map.end()) return Anime::SeriesStatus::UNKNOWN; return map.at(status); } Anime::SeriesSeason ToSeriesSeason(std::string season) { static const std::unordered_map<std::string, Anime::SeriesSeason> map = { {"WINTER", Anime::SeriesSeason::WINTER}, {"SPRING", Anime::SeriesSeason::SPRING}, {"SUMMER", Anime::SeriesSeason::SUMMER}, {"FALL", Anime::SeriesSeason::FALL } }; if (map.find(season) == map.end()) return Anime::SeriesSeason::UNKNOWN; return map.at(season); } Anime::SeriesFormat ToSeriesFormat(std::string format) { static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { {"TV", Anime::SeriesFormat::TV }, {"TV_SHORT", Anime::SeriesFormat::TV_SHORT}, {"MOVIE", Anime::SeriesFormat::MOVIE }, {"SPECIAL", Anime::SeriesFormat::SPECIAL }, {"OVA", Anime::SeriesFormat::OVA }, {"ONA", Anime::SeriesFormat::ONA }, {"MUSIC", Anime::SeriesFormat::MUSIC }, {"MANGA", Anime::SeriesFormat::MANGA }, {"NOVEL", Anime::SeriesFormat::NOVEL }, {"ONE_SHOT", Anime::SeriesFormat::ONE_SHOT} }; if (map.find(format) == map.end()) return Anime::SeriesFormat::UNKNOWN; return map.at(format); } } // namespace AniList } // namespace Translate