Mercurial > minori
diff src/gui/translate/anilist.cc @ 301:b1f625b0227c
*: convert all files CRLF -> LF
some files were in DOS format, others were in unix. now everything
(that at least is under our control) should all be the same format
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 13 May 2024 15:04:51 -0400 |
parents | 657fda1b9cac |
children | 2115488eb302 |
line wrap: on
line diff
--- a/src/gui/translate/anilist.cc Mon May 13 14:56:37 2024 -0400 +++ b/src/gui/translate/anilist.cc Mon May 13 15:04:51 2024 -0400 @@ -1,51 +1,51 @@ -#include "gui/translate/anilist.h" -#include <unordered_map> - -namespace Translate { -namespace AniList { - -Anime::SeriesStatus ToSeriesStatus(const 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::NotYetReleased}, - {"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(const 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(const std::string& format) { - static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { - {"TV", Anime::SeriesFormat::Tv }, - {"TV_SHORT", Anime::SeriesFormat::TvShort}, - {"MOVIE", Anime::SeriesFormat::Movie }, - {"SPECIAL", Anime::SeriesFormat::Special }, - {"OVA", Anime::SeriesFormat::Ova }, - {"ONA", Anime::SeriesFormat::Ona }, - {"MUSIC", Anime::SeriesFormat::Music } - }; - - if (map.find(format) == map.end()) - return Anime::SeriesFormat::Unknown; - return map.at(format); -} - -} // namespace AniList -} // namespace Translate +#include "gui/translate/anilist.h" +#include <unordered_map> + +namespace Translate { +namespace AniList { + +Anime::SeriesStatus ToSeriesStatus(const 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::NotYetReleased}, + {"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(const 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(const std::string& format) { + static const std::unordered_map<std::string, enum Anime::SeriesFormat> map = { + {"TV", Anime::SeriesFormat::Tv }, + {"TV_SHORT", Anime::SeriesFormat::TvShort}, + {"MOVIE", Anime::SeriesFormat::Movie }, + {"SPECIAL", Anime::SeriesFormat::Special }, + {"OVA", Anime::SeriesFormat::Ova }, + {"ONA", Anime::SeriesFormat::Ona }, + {"MUSIC", Anime::SeriesFormat::Music } + }; + + if (map.find(format) == map.end()) + return Anime::SeriesFormat::Unknown; + return map.at(format); +} + +} // namespace AniList +} // namespace Translate