-
Notifications
You must be signed in to change notification settings - Fork 7
/
ZiggeoStreams.py
50 lines (38 loc) · 3.14 KB
/
ZiggeoStreams.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
44
45
46
47
48
49
class ZiggeoStreams:
def __init__(self, application):
self.__application = application
def index(self, video_token_or_key, data = None):
return self.__application.connect.getJSON('/v1/videos/' + video_token_or_key + '/streams', data)
def get(self, video_token_or_key, token_or_key):
return self.__application.connect.getJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '')
def download_video(self, video_token_or_key, token_or_key):
return self.__application.cdn_connect.get('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/video')
def download_image(self, video_token_or_key, token_or_key):
return self.__application.cdn_connect.get('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/image')
def push_to_service(self, video_token_or_key, token_or_key, data = None):
return self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/push', data)
def delete(self, video_token_or_key, token_or_key):
return self.__application.connect.delete('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '')
def create(self, video_token_or_key, data = None, file = None):
if (file != None):
result = self.__application.connect.postUploadJSON('/v1/videos/' + video_token_or_key + '/streams-upload-url', 'stream', data, file, 'video_type')
result = self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + result['token'] + '/confirm-video')
return result
else:
return self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams', data, file)
def attach_image(self, video_token_or_key, token_or_key, data = None, file = None):
if (file != None):
result = self.__application.connect.postUploadJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/image-upload-url', 'stream', data, file)
result = self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/confirm-image')
return result
else:
return self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/image', data, file)
def attach_video(self, video_token_or_key, token_or_key, data = None, file = None):
if (file != None):
result = self.__application.connect.postUploadJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/video-upload-url', 'stream', data, file, 'video_type')
result = self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/confirm-video')
return result
else:
return self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/video', data, file)
def attach_subtitle(self, video_token_or_key, token_or_key, data = None):
return self.__application.connect.postJSON('/v1/videos/' + video_token_or_key + '/streams/' + token_or_key + '/subtitle', data)