86 lines
2.1 KiB
C++
86 lines
2.1 KiB
C++
#pragma once
|
|
#include <glaze/core/common.hpp>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <teamspeak/public_definitions.h>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace definitions
|
|
{
|
|
|
|
struct StreamInfo {
|
|
std::string url;
|
|
int itag = 0;
|
|
std::string mimeType;
|
|
int bitrate = 0;
|
|
int width = 0;
|
|
int height = 0;
|
|
};
|
|
|
|
struct Streams {
|
|
StreamInfo audio;
|
|
StreamInfo video;
|
|
};
|
|
|
|
struct QueueItem {
|
|
std::string name;
|
|
std::string videoId;
|
|
std::string shortUrl;
|
|
std::string length;
|
|
std::string requester;
|
|
std::optional<Streams> streams;
|
|
|
|
QueueItem() = default;
|
|
|
|
QueueItem(std::string name, std::string videoId,
|
|
std::string shortUrl, std::string length,
|
|
std::string requested_by,
|
|
const std::optional<Streams> &streams)
|
|
: name{std::move(name)}, videoId(std::move(videoId)),
|
|
shortUrl(std::move(shortUrl)), length(std::move(length)),
|
|
requester{std::move(requested_by)}, streams{streams}
|
|
{
|
|
}
|
|
};
|
|
|
|
struct SearchResultItem {
|
|
std::string name;
|
|
std::string length;
|
|
std::string thumbnail;
|
|
std::string viewCount;
|
|
std::string url;
|
|
std::string shortUrl;
|
|
std::string videoId;
|
|
};
|
|
|
|
struct PluginState {
|
|
std::vector<QueueItem> queue;
|
|
std::vector<anyID> onlineSubscribers;
|
|
std::vector<anyID> offlineSubscribers;
|
|
std::uint64_t serverConnection;
|
|
bool wasPlaying = false;
|
|
};
|
|
} // namespace definitions
|
|
|
|
template <> struct glz::meta<definitions::StreamInfo> {
|
|
using T = definitions::StreamInfo;
|
|
static constexpr auto value = object(
|
|
"url", &T::url, "itag", &T::itag, "mimeType", &T::mimeType,
|
|
"bitrate", &T::bitrate, "width", &T::width, "height", &T::height);
|
|
};
|
|
|
|
template <> struct glz::meta<definitions::Streams> {
|
|
using T = definitions::Streams;
|
|
static constexpr auto value =
|
|
object("audio", &T::audio, "video", &T::video);
|
|
};
|
|
|
|
template <> struct glz::meta<definitions::QueueItem> {
|
|
using T = definitions::QueueItem;
|
|
static constexpr auto value =
|
|
object("name", &T::name, "videoId", &T::videoId, "shortUrl",
|
|
&T::shortUrl, "length", &T::length, "requester",
|
|
&T::requester, "streams", &T::streams);
|
|
};
|