Mercurial > minori
view src/services/services.cc @ 327:b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
ToLocalString has also been altered to take in both season
and year because lots of locales actually treat formatting
seasons differently! most notably is Russian which adds a
suffix at the end to notate seasons(??)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 13 Jun 2024 01:49:18 -0400 |
parents | 78929794e7d8 |
children | 948955c3ba81 |
line wrap: on
line source
#include "services/services.h" #include "core/session.h" #include "gui/translate/anime.h" #include "services/anilist.h" #include "services/kitsu.h" namespace Services { void Synchronize() { session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime list..."); switch (session.config.service) { case Anime::Service::AniList: AniList::GetAnimeList(); break; case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break; default: break; } } bool RetrieveAnimeMetadata(int id) { switch (session.config.service) { case Anime::Service::Kitsu: return Kitsu::RetrieveAnimeMetadata(id); default: return false; } } std::vector<int> Search(const std::string& search) { session.SetStatusBar(Translate::ToString(session.config.service) + ": Requesting search query..."); switch (session.config.service) { case Anime::Service::AniList: return AniList::Search(search); case Anime::Service::Kitsu: return Kitsu::Search(search); default: return {}; } } bool GetSeason(Anime::Season season) { session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime season data..."); switch (session.config.service) { case Anime::Service::AniList: return AniList::GetSeason(season); case Anime::Service::Kitsu: return Kitsu::GetSeason(season); default: return {}; } } void UpdateAnimeEntry(int id) { session.SetStatusBar(Translate::ToString(session.config.service) + ": Updating remote anime entry..."); switch (session.config.service) { case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break; case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break; default: break; } } }; // namespace Services