#ifndef VIDEO_H #define VIDEO_H #include #include #include #include /// /// \brief Video namespace. /// Contains the format, thumbnail, and video structs. /// namespace Video { /// /// \brief Format structure. /// This saves a video format, with the necessary url and information. /// struct format { std::string format; /**< Name of the format provided by Youtube */ std::string url; std::string vcodec; std::string acodec; std::string ext; /**< File Extention */ std::optional quality; std::optional resolution; std::optional height; std::optional width; }; /// /// \brief Thumbnail structure. /// This saves a video thumbnail, with the necessary url and information. /// struct thumbnail { std::string url; int preference; /**< The lower the prefrence, the worse the quality */ std::string id; std::optional resolution; std::optional height; std::optional width; }; /// /// \brief Video structure. /// The video structure will be used to store video objects, and will be used to /// save to DB, and as a common format between invidious.io and yt-dlp. /// struct video { std::string id; std::string title; std::string url; std::string channelId; std::string channelUrl; std::vector formats; std::vector thumbnails; std::optional uploader; std::optional uploaderId; std::optional uploaderUrl; std::optional duration; std::optional viewcount; std::optional description; }; void to_json(nlohmann::json& j, const format& f); void to_json(nlohmann::json& j, const std::vector& v); void to_json(nlohmann::json& j, const thumbnail& t); void to_json(nlohmann::json& j, const std::vector& v); void to_json(nlohmann::json& j, const video& v); void from_json(const nlohmann::json& j, format& f); void from_json(const nlohmann::json& j, std::vector& v); void from_json(const nlohmann::json& j, thumbnail& t); void from_json(const nlohmann::json& j, std::vector& v); void from_json(const nlohmann::json& j, video& v); }; #endif