From 12df82c1a90208a822ebdf3d5f4994d55ef7cbea Mon Sep 17 00:00:00 2001 From: ComradeCrow Date: Wed, 30 Aug 2023 19:12:22 -0700 Subject: update --- include/invapi.hpp | 12 ++++++++++-- include/sqliteinterface.hpp | 2 ++ include/ytcpp.hpp | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 include/ytcpp.hpp (limited to 'include') diff --git a/include/invapi.hpp b/include/invapi.hpp index 3fb4c05..bcd5eef 100644 --- a/include/invapi.hpp +++ b/include/invapi.hpp @@ -9,10 +9,18 @@ class InvidiousApi { public: + struct instance { - InvidiousApi(const std::string& url); - static std::vector getInstances(); + std::string url; + float health; + std::string location; + }; + + InvidiousApi(const std::string& url) : instanceUrl(url) {}; + static std::vector getInstancesUrls(); + static std::vector getInstances(); static void saveInstancesToDb(SqliteInterface& sqldb); + static std::string getInstanceUrlFromDb(SqliteInterface& sqldb); std::string getInstance(); void setInstance(const std::string& newUrl); diff --git a/include/sqliteinterface.hpp b/include/sqliteinterface.hpp index 5c7de4d..42965d2 100644 --- a/include/sqliteinterface.hpp +++ b/include/sqliteinterface.hpp @@ -3,6 +3,7 @@ #include #include #include "video.hpp" +#include "invapi.hpp" class SqliteInterface { @@ -14,6 +15,7 @@ class SqliteInterface { void createTables(); void saveVideo(const Video::video&); void saveInstance(const char *uri, float health, const char *location); + void saveInstance(const InvidiousApi::instance&); private: sqlite3* db; }; diff --git a/include/ytcpp.hpp b/include/ytcpp.hpp new file mode 100644 index 0000000..2e32ecc --- /dev/null +++ b/include/ytcpp.hpp @@ -0,0 +1 @@ +void spawn(const char* url, bool wait); \ No newline at end of file -- cgit 1.4.1-2-gfad0