about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp60
1 files changed, 36 insertions, 24 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6f3ce18..3ee071a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,6 +9,15 @@
 #include <fstream>
 #include <filesystem>
 #include <stdlib.h>
+#ifdef __unix
+#include <unistd.h>
+#include <spawn.h>
+#elif __posix
+#include <unistd.h>
+#include <spawn.h>
+#elif _WIN32
+#include <windows.h>
+#endif
 
 #include "tui.hpp"
 #include "video.hpp"
@@ -60,39 +69,42 @@ void parseSysArgs(int argc, char **argv) {
     }
 }
 
+
+
 int main(int argc, char **argv) {
 
     parseSysArgs(argc, argv);
-    
+    #ifdef _WIN32
+        start mpv
+        bool CreateProcessA()
+    #elif __unix
+        extern char **environ;
 
-    validateStructConversions();
-    
-    // YtdlpWrapper yt;
-    // Video::video vid = yt.getVideoByUrl("https://youtu.be/jy5x7bDYd4o?list=OLAK5uy_kSLxuOA_vBO8SsXaI6PjJbqvsIBnBReGM");
-    // cout << vid.id << ", " << vid.url << endl;
-    // yt.~YtdlpWrapper();
+        int i{0};
+        while ((environ[i]) != nullptr) {
 
-    // vector<Video::video> response = yt.searchVideos("factorio");
-    // for (Video::video i: response) {
+            cout << environ[i++] << endl;
+        }
+        pid_t pid{0};
+        fs::path vidFile("It's Time to Celebrate [K3qjudqERKU].webm");
+        char *const mpvArgs[] = {strdup("mpv"), strdup(fs::absolute(vidFile).c_str()), nullptr};
+
+        i = 0;
+        while ((mpvArgs[i]) != nullptr) {
 
-    //     cout << i.id << ", " << i.url << ", " << endl; 
-    // }
+            cout << mpvArgs[i++] << " ";
+        } 
+        cout << endl;
 
-    // nlohmann::json j = yt.getJsonSearch("the very thought of you");
-    // cout << j << endl;
+        int result = posix_spawnp(&pid, mpvArgs[0], NULL, NULL, mpvArgs, environ);
+        if (result != 0) { 
 
-    // SqliteInterface data;
+            cout << "ERROR RUNNING " << mpvArgs[0] << "! Error code " << result << ": " << strerror(result) << endl;
+        } else {
 
-    // vector<string> instances = getInstances();
-    // for (auto i: instances) {
-    //     cout << i << " ";
-    // }
-    // cout << endl;
+            cout << "pid: " << pid << endl;
+        }
 
-    string searchTerm;
-    int searchingFor{-1};
+    #endif
 
-    Tui ux;
-    ux.renderSearchBar(searchTerm, searchingFor);
-    cout << searchTerm << searchingFor << endl;
 }
\ No newline at end of file
4ea0f69aed8d4c173d9abbd0a1bd76d6afe69ccb'>^
29028631 ^

a2853ab6 ^
3ee05c16 ^

f8f6f7f9 ^






29028631 ^
f8f6f7f9 ^









f8f6f7f9 ^






dade4742 ^
fd29d7e6 ^
0df1d653 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95