diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/YtdlpWrapper.hpp | 20 | ||||
-rw-r--r-- | src/invapi.hpp | 27 | ||||
-rw-r--r-- | src/main.cpp | 12 | ||||
-rw-r--r-- | src/sqliteinterface.hpp | 21 | ||||
-rw-r--r-- | src/tui.hpp | 23 | ||||
-rw-r--r-- | src/video.hpp | 61 |
6 files changed, 6 insertions, 158 deletions
diff --git a/src/YtdlpWrapper.hpp b/src/YtdlpWrapper.hpp deleted file mode 100644 index 9ee2410..0000000 --- a/src/YtdlpWrapper.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef YTDLPWRAPPER_H -#define YTDLPWRAPPER_H -#include <string> -#include <vector> -#include <iostream> -#include <pybind11/embed.h> -#include <nlohmann/json.hpp> - -class YtdlpWrapper { - - public: - nlohmann::json getJsonSearch(const std::string& searchTerm, int limit = 1); - Video::video getVideoByUrl(const std::string& url); - std::vector<Video::video> searchVideos(const std::string& searchterm, int limit = 1); - private: - pybind11::object get_ytdl(); -}; - - -#endif \ No newline at end of file diff --git a/src/invapi.hpp b/src/invapi.hpp deleted file mode 100644 index 3fb4c05..0000000 --- a/src/invapi.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INVAPI_H -#define INVAPI_H -#include <string> -#include <vector> -#include <cpr/cpr.h> - -#include "sqliteinterface.hpp" - -class InvidiousApi { - - public: - - InvidiousApi(const std::string& url); - static std::vector<std::string> getInstances(); - static void saveInstancesToDb(SqliteInterface& sqldb); - std::string getInstance(); - void setInstance(const std::string& newUrl); - - void test(); - private: - - std::string instanceUrl; - cpr::Session session; -}; - - -#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 1bac482..ea955f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,11 +18,11 @@ #include <sys/wait.h> #endif -#include "tui.hpp" -#include "video.hpp" -#include "invapi.hpp" -#include "YtdlpWrapper.hpp" -#include "sqliteinterface.hpp" +#include <tui.hpp> +#include <video.hpp> +#include <invapi.hpp> +#include <YtdlpWrapper.hpp> +#include <sqliteinterface.hpp> // namespace py = pybind11; @@ -137,7 +137,7 @@ int main(int argc, char **argv) { // validateStructConversions(); parseSysArgs(argc, argv); - // SqliteInterface sqldb; + SqliteInterface sqldb; // InvidiousApi invapi("https://httpbin.org/get"); // invapi.test(); } \ No newline at end of file diff --git a/src/sqliteinterface.hpp b/src/sqliteinterface.hpp deleted file mode 100644 index cc4adb4..0000000 --- a/src/sqliteinterface.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SQLITEINTERFACE_H -#define SQLITEINTERFACE_H -#include <string> -#include <sqlite3.h> -#include "video.hpp" - -class SqliteInterface { - - public: - SqliteInterface(); - ~SqliteInterface(); - void openDB(); - void closeDB(); - void createTables(); - void saveVideo(const Video::video&); - void saveInstance(const std::string& uri, float health, const std::string& location); - private: - sqlite3* db; -}; - -#endif \ No newline at end of file diff --git a/src/tui.hpp b/src/tui.hpp deleted file mode 100644 index 112135c..0000000 --- a/src/tui.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TUI_H -#define TUI_H -#include <string> -#include "ftxui/component/captured_mouse.hpp" // for ftxui -#include "ftxui/component/component.hpp" // for Input, Renderer, Vertical -#include "ftxui/component/component_base.hpp" // for ComponentBase -#include "ftxui/component/component_options.hpp" // for InputOption -#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive -#include "ftxui/dom/elements.hpp" // for text, hbox, separator, Element, operator|, vbox, border -#include "ftxui/util/ref.hpp" // for Ref - -class Tui { - public: - bool renderSearchBar(std::string&, int&); - bool isCancelled(); - private: - ftxui::Closure cancelAndExit(ftxui::ScreenInteractive&); - bool cancel{false}; - -}; - - -#endif \ No newline at end of file diff --git a/src/video.hpp b/src/video.hpp deleted file mode 100644 index fd57d0b..0000000 --- a/src/video.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef VIDEO_H -#define VIDEO_H -#include <string> -#include <optional> -#include <vector> -#include <nlohmann/json.hpp> - -namespace Video { - - struct format { - - std::string format; - std::string url; - std::string vcodec; - std::string acodec; - std::string ext; - std::optional<float> quality; - std::optional<std::string> resolution; - std::optional<int> height; - std::optional<int> width; - }; - - struct thumbnail { - - std::string url; - int preference; - std::string id; - std::optional<std::string> resolution; - std::optional<int> height; - std::optional<int> width; - }; - - struct video { - - std::string id; - std::string title; - std::string url; - std::string channelId; - std::string channelUrl; - std::vector<format> formats; - std::vector<thumbnail> thumbnails; - std::optional<std::string> uploader; - std::optional<std::string> uploaderId; - std::optional<std::string> uploaderUrl; - std::optional<int> duration; - std::optional<int> viewcount; - std::optional<std::string> description; - }; - - void to_json(nlohmann::json& j, const format& f); - void to_json(nlohmann::json& j, const std::vector<format>& v); - void to_json(nlohmann::json& j, const thumbnail& t); - void to_json(nlohmann::json& j, const std::vector<thumbnail>& 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<format>& v); - void from_json(const nlohmann::json& j, thumbnail& t); - void from_json(const nlohmann::json& j, std::vector<thumbnail>& v); - void from_json(const nlohmann::json& j, video& v); -}; -#endif \ No newline at end of file |