-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
43 lines (32 loc) · 1006 Bytes
/
test.py
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
import threading
import sys
#from pytube import YouTube
from ctypes import *
lib = cdll.LoadLibrary('./vrok.so')
lib.CreateContext.argtypes = []
lib.CreateContext.restypes = []
lib.CreatePlayer.argtypes = []
lib.CreatePlayer.restypes = [c_void_p]
lib.CreateResource.argtypes = [c_char_p]
lib.CreateResource.restype = c_void_p
lib.SubmitForPlayback.argtypes = [c_void_p]
lib.SubmitForPlayback.restype = None
lib.SubmitForPlaybackNow.argtypes = [c_void_p]
lib.SubmitForPlaybackNow.restype = None
player=None
def worker():
lib.CreateContext()
player=lib.CreatePlayer()
lib.JoinPlayer();
th=threading.Thread(target=worker)
th.start()
#yt = YouTube()
while (True):
filename=sys.stdin.readline()[:-1]
#if (filename.startswith("https://www.youtube")):
# yt.url = filename
# filename = yt.videos[-1].url
# print(filename)
c_filename=create_string_buffer(filename.encode('utf-8'))
o=lib.CreateResource(c_filename);
lib.SubmitForPlaybackNow(o)