1 parent
dede07748a
commit
97dc183bdf
6 files changed
+77
-69
No files matched your search
@@ -48,6 +48,7 @@ namespace Echoion::Api
|
||||
[[nodiscard]] const BotConfig& getBot() const;
|
||||
[[nodiscard]] const YouTubeConfig& getYouTube() const;
|
||||
[[nodiscard]] const NetworkConfig& getNetwork() const;
|
||||
[[nodiscard]] const SourcesConfig& getSources() const;
|
||||
[[nodiscard]] const TeamSpeakConfig& getTeamSpeak() const;
|
||||
[[nodiscard]] const SecurityConfig& getSecurity() const;
|
||||
[[nodiscard]] const FeaturesConfig& getFeatures() const;
|
||||
|
||||
@@ -31,17 +31,12 @@ namespace Echoion::Api
|
||||
std::string commandPrefix = "!";
|
||||
float defaultVolume = 0.5f;
|
||||
uint32_t maxQueueSize = 100;
|
||||
// How long the playback engine waits (emitting silence) for a
|
||||
// late stream resolve before skipping the track.
|
||||
std::chrono::milliseconds trackTimeout =
|
||||
std::chrono::milliseconds(30000);
|
||||
|
||||
// Reconnection settings
|
||||
bool autoReconnect = true;
|
||||
std::chrono::milliseconds reconnectDelay =
|
||||
std::chrono::milliseconds(5000);
|
||||
uint32_t maxReconnectAttempts = 5;
|
||||
|
||||
// Audio quality settings
|
||||
AudioQuality preferredQuality = AudioQuality::High;
|
||||
std::chrono::milliseconds(10000);
|
||||
// Crossfade between tracks; 0 = plain gapless handoff.
|
||||
std::chrono::milliseconds crossfade = std::chrono::milliseconds(0);
|
||||
bool allowPlaylistImports = true;
|
||||
};
|
||||
|
||||
@@ -63,6 +58,33 @@ namespace Echoion::Api
|
||||
std::string rpcBindAddress = "127.0.0.1";
|
||||
};
|
||||
|
||||
// Music source resolution chain. Default order tries the native
|
||||
// innertube YouTube path and Yandex Music first, then falls back to
|
||||
// (optionally proxied) yt-dlp last.
|
||||
struct SourcesConfig {
|
||||
std::vector<std::string> order = {
|
||||
"innertube", "yandex", "direct-url",
|
||||
"ytdlp-direct", "ytdlp-proxied"};
|
||||
// How long a failing source is skipped before being retried.
|
||||
std::chrono::milliseconds failureCooldown =
|
||||
std::chrono::milliseconds(300000); // 5m
|
||||
// Hedged stream resolution: when the first source hasn't
|
||||
// answered within this delay, the second candidate races it
|
||||
// (first success wins). 0 disables hedging.
|
||||
std::chrono::milliseconds hedgeDelay =
|
||||
std::chrono::milliseconds(300);
|
||||
// Native innertube player API (fastest YouTube path; one HTTP
|
||||
// POST). youtubei is geo-blocked without a proxy, so with
|
||||
// requireProxy the source is skipped when none is configured.
|
||||
bool innertubeEnabled = true;
|
||||
bool innertubeRequireProxy = true;
|
||||
// Native Yandex Music (unofficial API). Full tracks require an
|
||||
// OAuth token from an account with Plus; without one, yandex
|
||||
// URLs fall back to ytdlp-direct.
|
||||
bool yandexEnabled = true;
|
||||
std::optional<std::string> yandexToken;
|
||||
};
|
||||
|
||||
// TeamSpeak Server Connection
|
||||
struct TeamSpeakConfig {
|
||||
std::string address = "localhost";
|
||||
@@ -100,30 +122,30 @@ namespace Echoion::Api
|
||||
bool autoStartOnSubscribe = true;
|
||||
bool pauseOnEmptySubscribers = true;
|
||||
bool resumeOnSubscriberReturn = true;
|
||||
// Radio mode: when the queue runs dry, enqueue tracks related to
|
||||
// the last played one (via Invidious recommendations).
|
||||
bool autoplay = false;
|
||||
|
||||
// Queue management
|
||||
std::string shuffleMode = "random";
|
||||
// Loudness normalization: slow AGC toward the target RMS level
|
||||
// so quiet and loud tracks play back at a similar volume.
|
||||
bool normalizeLoudness = false;
|
||||
float targetLoudnessDb = -14.0f;
|
||||
|
||||
// Queue management: initial state on cold start ("off"/"random",
|
||||
// "off"/"all"). Runtime toggles are not written back.
|
||||
std::string shuffleMode = "off";
|
||||
std::string repeatMode = "off";
|
||||
uint32_t maxHistorySize = 50;
|
||||
};
|
||||
|
||||
// Advanced Settings
|
||||
struct AdvancedConfig {
|
||||
// Audio configuration
|
||||
uint32_t sampleRate = 192000;
|
||||
uint32_t channels = 2;
|
||||
uint32_t bufferSize = 7680;
|
||||
|
||||
// Thread pool configuration
|
||||
uint32_t commandThreadPoolSize = 4;
|
||||
uint32_t networkThreadPoolSize = 4;
|
||||
uint32_t decoderThreads = 2;
|
||||
|
||||
// Cache settings
|
||||
// Local audio track cache (downloaded/streamed files reused
|
||||
// across plays and restarts).
|
||||
bool cacheEnabled = true;
|
||||
std::string cacheMaxSize = "1GB";
|
||||
uint32_t cacheTTL = 86400;
|
||||
uint32_t tempCleanupInterval = 3600;
|
||||
uint32_t cacheTTL = 86400; // seconds
|
||||
uint32_t tempCleanupInterval = 3600; // seconds
|
||||
};
|
||||
|
||||
// ServerConfig for Plugin interface (mirrors PluginTypes.hpp version)
|
||||
@@ -153,6 +175,7 @@ namespace Echoion::Api
|
||||
BotConfig bot;
|
||||
YouTubeConfig youtube;
|
||||
NetworkConfig network;
|
||||
SourcesConfig sources;
|
||||
TeamSpeakConfig teamspeak;
|
||||
SecurityConfig security;
|
||||
FeaturesConfig features;
|
||||
|
||||
@@ -112,6 +112,10 @@ namespace Echoion::Api
|
||||
[[nodiscard]] Api::Result<std::vector<Playlist>>
|
||||
getUserPlaylists(uint64_t userId);
|
||||
|
||||
// Get every playlist (used by the RPC GetPlaylists endpoint).
|
||||
[[nodiscard]] Api::Result<std::vector<Playlist>>
|
||||
getAllPlaylists();
|
||||
|
||||
// Update playlist
|
||||
Api::Result<void> updatePlaylist(
|
||||
uint64_t id,
|
||||
@@ -185,6 +189,14 @@ namespace Echoion::Api
|
||||
std::vector<std::pair<TrackInfo, uint64_t>>>
|
||||
getMostPlayed(uint64_t userId, size_t limit = 10);
|
||||
|
||||
// ===== Key/value store =====
|
||||
// Small persisted state (healthy instance lists, ...). Values
|
||||
// are opaque strings (callers serialize as needed).
|
||||
[[nodiscard]] Api::Result<std::optional<std::string>>
|
||||
getKv(const std::string& key);
|
||||
Api::Result<void> setKv(const std::string& key,
|
||||
const std::string& value);
|
||||
|
||||
// ===== Subscriptions =====
|
||||
|
||||
// Subscriber info
|
||||
|
||||
@@ -143,12 +143,6 @@ namespace Echoion::Api::Events
|
||||
std::string reason;
|
||||
};
|
||||
|
||||
struct ChannelChanged {
|
||||
uint64_t clientId;
|
||||
uint64_t oldChannelId;
|
||||
uint64_t newChannelId;
|
||||
};
|
||||
|
||||
// Error events
|
||||
struct PlaybackError {
|
||||
ErrorCode code;
|
||||
@@ -156,45 +150,9 @@ namespace Echoion::Api::Events
|
||||
std::optional<TrackInfo> track;
|
||||
};
|
||||
|
||||
struct NetworkError {
|
||||
std::string url;
|
||||
ErrorCode code;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
// Configuration events
|
||||
struct ConfigReloaded {
|
||||
BotConfig newConfig;
|
||||
};
|
||||
|
||||
struct ConfigChanged {
|
||||
std::string key;
|
||||
std::string oldValue;
|
||||
std::string newValue;
|
||||
};
|
||||
|
||||
// Cache events
|
||||
struct CacheHit {
|
||||
std::string key;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct CacheMiss {
|
||||
std::string key;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct CacheEvicted {
|
||||
std::string key;
|
||||
std::string reason;
|
||||
};
|
||||
|
||||
// Database persistence events (for audit/logging)
|
||||
struct DatabasePersisted {
|
||||
std::string entityType; // "queue", "playback", ...
|
||||
std::string operation; // "insert", "update", "delete"
|
||||
bool success;
|
||||
std::optional<std::string> error;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api::Events
|
||||
@@ -58,7 +58,18 @@ namespace Echoion::Api
|
||||
// Server info
|
||||
GetServerInfo,
|
||||
RequestLoginToken,
|
||||
ValidateLoginToken
|
||||
ValidateLoginToken,
|
||||
|
||||
// Playback mode (appended; numeric values are server-internal and
|
||||
// only need to stay self-consistent — the wire contract is the name)
|
||||
ToggleShuffle,
|
||||
ToggleRepeat,
|
||||
ShuffleQueue,
|
||||
|
||||
// Library (appended)
|
||||
GetPlaylist, // playlist contents by id
|
||||
GetHistory, // recently played tracks
|
||||
GetStats // playback statistics
|
||||
};
|
||||
|
||||
struct RpcRequest {
|
||||
|
||||
@@ -18,7 +18,10 @@ namespace Echoion::Api
|
||||
SoundCloud,
|
||||
Spotify,
|
||||
LocalFile,
|
||||
URL
|
||||
URL,
|
||||
// Appended after URL so existing uint8_t-serialized history rows
|
||||
// keep their meaning.
|
||||
Yandex
|
||||
};
|
||||
|
||||
struct TrackInfo {
|
||||
|
||||
Reference in new issue
Block a user