view src/services/services.cc @ 316:180714442770

settings: clean up code
author Paper <paper@paper.us.eu.org>
date Tue, 11 Jun 2024 15:11:09 -0400
parents 2115488eb302
children b1f4d1867ab1
line wrap: on
line source

#include "services/services.h"
#include "core/session.h"
#include "gui/dialog/settings.h"
#include "services/anilist.h"

namespace Services {

void Synchronize() {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::GetAnimeList(); break;
		default: break;
	}
}

std::vector<int> Search(const std::string& search) {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::Search(search);
		default: return {};
	}
}

std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::GetSeason(season, year);
		default: return {};
	}
}

void UpdateAnimeEntry(int id) {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;
		default: break;
	}
}

bool Authorize() {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::AuthorizeUser();
		default: return true;
	}
}

}; // namespace Services