From 772637e0947286e54ab97b8d55ad2c05fe9a1c86 Mon Sep 17 00:00:00 2001 From: ComradeCrow Date: Tue, 18 Apr 2023 17:39:43 -0700 Subject: hotfix --- CMakeLists.txt | 1 - src/YtdlpWrapper.cpp | 5 ++--- src/YtdlpWrapper.hpp | 2 +- src/main.cpp | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fbdca..25833e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ftxui::component PRIVATE nlohmann_json::nlohmann_json PRIVATE SQLite::SQLite3 - ## ${PCAP_LIBRARY} PRIVATE pybind11::embed ) diff --git a/src/YtdlpWrapper.cpp b/src/YtdlpWrapper.cpp index ca1d4a4..2b87a62 100644 --- a/src/YtdlpWrapper.cpp +++ b/src/YtdlpWrapper.cpp @@ -24,10 +24,9 @@ py::object YtdlpWrapper::get_ytdl() { return ytdl; } -json YtdlpWrapper::getJsonSearch(const string& searchTerm) { +json YtdlpWrapper::getJsonSearch(const string& searchTerm, int limit) { - // py::object info = get_ytdl().attr("extract_info")("ytsearch:"+searchTerm, "download"_a=py::bool_(false)); - py::dict info("test"_a=py::bool_(true), "test2"_a=py::str("yoyoyo"), "test3"_a=py::none()); + py::dict info = get_ytdl().attr("extract_info")("ytsearch"+std::to_string(limit)+":"+searchTerm, "download"_a=py::bool_(false)); return json::parse(pyDictToJsonString(info)); } diff --git a/src/YtdlpWrapper.hpp b/src/YtdlpWrapper.hpp index 6cc045d..f7cc256 100644 --- a/src/YtdlpWrapper.hpp +++ b/src/YtdlpWrapper.hpp @@ -6,7 +6,7 @@ class YtdlpWrapper { public: - nlohmann::json getJsonSearch(const string& searchTerm); + nlohmann::json getJsonSearch(const string& searchTerm, int limit = 1); private: pybind11::object get_ytdl(); pybind11::object ytdl = pybind11::none(); diff --git a/src/main.cpp b/src/main.cpp index a03461f..f258c24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ int main() { py::scoped_interpreter guard{}; YtdlpWrapper yt; - nlohmann::json j = yt.getJsonSearch("All Quiet on the Western Front Ost"); - cout << j << endl; + // nlohmann::json j = yt.getJsonSearch("All Quiet on the Western Front Ost"); + // cout << j << endl; // vector instances = getInstances(); // for (auto i: instances) { -- cgit 1.4.1-2-gfad0