#pragma once #include #include "LoginBlob.h" #include "MercurySession.h" #include "TimeProvider.h" #include "protobuf/metadata.pb.h" namespace cspot { struct Context { struct ConfigState { // Setup default bitrate to 160 AudioFormat audioFormat = AudioFormat::AudioFormat_OGG_VORBIS_160; std::string deviceId; std::string deviceName; int volume; std::string username; std::string countryCode; }; ConfigState config; std::shared_ptr timeProvider; std::shared_ptr session; static std::shared_ptr createFromBlob( std::shared_ptr blob) { auto ctx = std::make_shared(); ctx->timeProvider = std::make_shared(); ctx->session = std::make_shared(ctx->timeProvider); ctx->config.deviceId = blob->getDeviceId(); ctx->config.deviceName = blob->getDeviceName(); ctx->config.volume = 0; ctx->config.username = blob->getUserName(); return ctx; } }; } // namespace cspot