""" Cattura CaptureCast API Plugin - Python Client Version 1.0.1 Automatically generated on Thu Nov 28 00:50:19 CST 2024 """ try: import urllib2 # Python 2 except ImportError: import urllib.request as urllib2 # Python 3 try: from urllib import urlencode # Python 2 except ImportError: from urllib.parse import urlencode # Python 3 import json """ To quickly import this API, use the statement: exec(urllib2.urlopen('http://16022.ominterhk.tech/api/1/describe/python').read()) or exec(urllib.request.urlopen('http://16022.ominterhk.tech/api/1/describe/python').read()) Or, to do it the correct way, download this file and import it as a module. """ class CaptureCastAPI (object): def __init__(self, host="16022.ominterhk.tech",username=None,password=None): if username is not None and password is not None: passwordmanager = urllib2.HTTPPasswordMgrWithDefaultRealm() passwordmanager.add_password(None,host,username,password) opener = urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passwordmanager)) else: opener = urllib2.build_opener() base_url = host if not base_url.startswith("http://") or base_url.startswith("https://"): base_url = "http://" + host version = "1" def make_request (url, verb, data): if not url.startswith("/"): url = "/api/{}/{}".format(version, url) url = "{}{}".format(base_url, url) data = urlencode(data) request = "{}?{}".format(url, data) if verb.lower() == 'post': request = urllib2.Request(url=url, data=data.encode("utf-8")) return json.loads(opener.open(request).read().decode("utf-8")) class capture (object): def startCapture (self,captureRequest): return make_request( verb = 'POST', url = 'capture/start'.format(), data = {'captureRequest': ('' if captureRequest is None else json.dumps(captureRequest))} ) def stopCapture (self): return make_request( verb = 'POST', url = 'capture/stop'.format(), data = {} ) def pauseCapture (self): return make_request( verb = 'POST', url = 'capture/pause'.format(), data = {} ) def resumeCapture (self): return make_request( verb = 'POST', url = 'capture/resume'.format(), data = {} ) def isDeviceCaptureAvailable (self): return make_request( verb = 'POST', url = 'capture/deviceCaptureIsAvailable'.format(), data = {} ) def isConcurrentCaptureEnabled (self): return make_request( verb = 'POST', url = 'capture/concurrentCaptureIsEnabled'.format(), data = {} ) def getTemplates (self): return make_request( verb = 'GET', url = 'templates'.format(), data = {} ) def getTemplate (self,id): return make_request( verb = 'GET', url = 'templates/{id}'.format(id=('' if id is None else id)), data = {} ) def testTemplate (self,id): return make_request( verb = 'POST', url = 'templates/{id}/test'.format(id=('' if id is None else id)), data = {} ) def createTemplate (self,id=None,title=None,description=None,graph=None,graphPath=None): return make_request( verb = 'POST', url = 'templates'.format(), data = {'id': ('' if id is None else id),'title': ('' if title is None else title),'description': ('' if description is None else description),'graph': ('' if graph is None else json.dumps(graph)),'graphPath': ('' if graphPath is None else graphPath)} ) def getMediaPackages (self,page=None,perPage=None): return make_request( verb = 'GET', url = 'mediaPackages'.format(), data = {'page': ('' if page is None else page),'perPage': ('' if perPage is None else perPage)} ) def getMediaPackage (self,id): return make_request( verb = 'GET', url = 'mediaPackages/{id}'.format(id=('' if id is None else id)), data = {} ) def attachToMediaPackage (self,id,key,element): return make_request( verb = 'POST', url = 'mediaPackages/{id}/outputs/{key}'.format(id=('' if id is None else id),key=('' if key is None else key)), data = {'element': ('' if element is None else json.dumps(element))} ) def deleteMediaPackage (self,id): return make_request( verb = 'DELETE', url = 'mediaPackages/{id}'.format(id=('' if id is None else id)), data = {} ) def publishMediaPackage (self,id,publishRequest): return make_request( verb = 'POST', url = 'mediaPackages/{id}/publish'.format(id=('' if id is None else id)), data = {'publishRequest': ('' if publishRequest is None else json.dumps(publishRequest))} ) def testPublisherConfiguration (self,publishRequest): return make_request( verb = 'POST', url = 'publishing/test'.format(), data = {'publishRequest': ('' if publishRequest is None else json.dumps(publishRequest))} ) def getSavedConfigurations (self,id): return make_request( verb = 'GET', url = 'publishing/configurations'.format(), data = {'id': ('' if id is None else id)} ) def updateSavedConfiguration (self,id,timestamp,config): return make_request( verb = 'POST', url = 'publishing/configurations/{id}/{timestamp}'.format(id=('' if id is None else id),timestamp=('' if timestamp is None else timestamp)), data = {'config': ('' if config is None else json.dumps(config))} ) def deleteSavedConfiguration (self,id,timestamp): return make_request( verb = 'DELETE', url = 'publishing/configurations/{id}/{timestamp}'.format(id=('' if id is None else id),timestamp=('' if timestamp is None else timestamp)), data = {} ) self.capture = capture() class status (object): def getUnitStatus (self,since=None): return make_request( verb = 'get', url = 'status'.format(), data = {'since': ('' if since is None else since)} ) def getUnitInfo (self): return make_request( verb = 'get', url = 'status/unit'.format(), data = {} ) def getNetworkInfo (self): return make_request( verb = 'get', url = 'status/network'.format(), data = {} ) def getDiskSpaceInfo (self): return make_request( verb = 'get', url = 'status/space'.format(), data = {} ) def getCaptureState (self): return make_request( verb = 'get', url = 'status/capture'.format(), data = {} ) def getConnectedDevices (self): return make_request( verb = 'get', url = 'status/devices'.format(), data = {} ) def getTodaysSchedule (self): return make_request( verb = 'get', url = 'status/schedule'.format(), data = {} ) self.status = status() class graphBuilder (object): def apiWrapper (self): return make_request( verb = 'get', url = 'graphBuilder/graph.js'.format(), data = {} ) def listGraphs (self): return make_request( verb = 'get', url = 'graphBuilder'.format(), data = {} ) def save (self,root): return make_request( verb = 'post', url = 'graphBuilder/{root}/save'.format(root=('' if root is None else root)), data = {} ) def copy (self,root,copyTo): return make_request( verb = 'post', url = 'graphBuilder/{root}/copy'.format(root=('' if root is None else root)), data = {'copyTo': ('' if copyTo is None else copyTo)} ) def createNode (self,root,pluginID,config,parentNodeIDs): return make_request( verb = 'post', url = 'graphBuilder/{root}/createNode'.format(root=('' if root is None else root)), data = {'pluginID': ('' if pluginID is None else pluginID),'config': ('' if config is None else json.dumps(config)),'parentNodeIDs': ('' if parentNodeIDs is None else parentNodeIDs)} ) def startCapture (self,root): return make_request( verb = 'post', url = 'graphBuilder/{root}/startCapture'.format(root=('' if root is None else root)), data = {} ) def stopCapture (self,root): return make_request( verb = 'post', url = 'graphBuilder/{root}/stopCapture'.format(root=('' if root is None else root)), data = {} ) def linkNode (self,root,nodeID,parentNodeIDs,childNodeIDs): return make_request( verb = 'post', url = 'graphBuilder/{root}/nodes/{nodeID}/link'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {'parentNodeIDs': ('' if parentNodeIDs is None else parentNodeIDs),'childNodeIDs': ('' if childNodeIDs is None else childNodeIDs)} ) def nodeOptions (self,root,nodeID): return make_request( verb = 'get', url = 'graphBuilder/{root}/nodes/{nodeID}/options'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {} ) def configureNode (self,root,nodeID,config): return make_request( verb = 'post', url = 'graphBuilder/{root}/nodes/{nodeID}/configure'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {'config': ('' if config is None else json.dumps(config))} ) def invokeService (self,root,nodeID,service,args): return make_request( verb = 'post', url = 'graphBuilder/{root}/nodes/{nodeID}/services/{service}'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID),service=('' if service is None else service)), data = {'args': ('' if args is None else json.dumps(args))} ) def getNode (self,root,nodeID): return make_request( verb = 'get', url = 'graphBuilder/{root}/nodes/{nodeID}'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {} ) def removeNode (self,root,nodeID): return make_request( verb = 'delete', url = 'graphBuilder/{root}/nodes/{nodeID}'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {} ) def getGraph (self,root): return make_request( verb = 'get', url = 'graphBuilder/{root}'.format(root=('' if root is None else root)), data = {} ) def make (self,root): return make_request( verb = 'post', url = 'graphBuilder/{root}'.format(root=('' if root is None else root)), data = {} ) self.graphBuilder = graphBuilder() class settings (object): def getSetting (self,setting): return make_request( verb = 'get', url = 'settings/{setting}'.format(setting=('' if setting is None else setting)), data = {} ) def setSetting (self,setting,value): return make_request( verb = 'post', url = 'settings/{setting}'.format(setting=('' if setting is None else setting)), data = {'value': ('' if value is None else value)} ) def getSettings (self): return make_request( verb = 'get', url = 'settings'.format(), data = {} ) def setSettings (self): return make_request( verb = 'post', url = 'settings'.format(), data = {} ) self.settings = settings() class users (object): def getUsers (self): return make_request( verb = 'get', url = 'users'.format(), data = {} ) self.users = users() class maintenance (object): def reboot (self): return make_request( verb = 'post', url = 'maintenance/reboot'.format(), data = {} ) def restart (self): return make_request( verb = 'post', url = 'maintenance/restart'.format(), data = {} ) def restartMediaProcessingModule (self): return make_request( verb = 'post', url = 'maintenance/restartMediaProcessingModule'.format(), data = {} ) self.maintenance = maintenance() class sessionStatus (object): def allNodes (self,root): return make_request( verb = 'get', url = 'sessionStatus/{root}/nodes'.format(root=('' if root is None else root)), data = {} ) self.sessionStatus = sessionStatus() class sessionOutput (object): def forNode (self,root,nodeID): return make_request( verb = 'get', url = 'sessionOutput/{root}/nodes/{nodeID}'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID)), data = {} ) def getFile (self,root,nodeID,fileName): return make_request( verb = 'get', url = 'sessionOutput/{root}/nodes/{nodeID}/{fileName}'.format(root=('' if root is None else root),nodeID=('' if nodeID is None else nodeID),fileName=('' if fileName is None else fileName)), data = {} ) def forAllNodes (self,root): return make_request( verb = 'get', url = 'sessionOutput/{root}'.format(root=('' if root is None else root)), data = {} ) self.sessionOutput = sessionOutput() class plugins (object): def getPlugins (self): return make_request( verb = 'get', url = 'plugins'.format(), data = {} ) def getSettingsForPlugin (self,plugin): return make_request( verb = 'get', url = 'plugins/{plugin}/settings'.format(plugin=('' if plugin is None else plugin)), data = {} ) def setSettingsForPlugin (self,plugin,settings): return make_request( verb = 'post', url = 'plugins/{plugin}/settings'.format(plugin=('' if plugin is None else plugin)), data = {'settings': ('' if settings is None else json.dumps(settings))} ) def callPluginService (self,plugin,service,args=None): return make_request( verb = 'post', url = 'plugins/{plugin}/{service}'.format(plugin=('' if plugin is None else plugin),service=('' if service is None else service)), data = {'args': ('' if args is None else json.dumps(args))} ) self.plugins = plugins() class devices (object): def getAudioDevices (self): return make_request( verb = 'get', url = 'devices/audio'.format(), data = {} ) def getVideoDevices (self): return make_request( verb = 'get', url = 'devices/video'.format(), data = {} ) def redetect (self): return make_request( verb = 'post', url = 'devices/redetect'.format(), data = {} ) def redetectProgress (self): return make_request( verb = 'get', url = 'devices/redetect/progress'.format(), data = {} ) self.devices = devices() class scheduler (object): def createEvent (self,presentationTitle,template,speaker,duration,startTime,tags): return make_request( verb = 'POST', url = 'scheduler/create'.format(), data = {'presentationTitle': ('' if presentationTitle is None else presentationTitle),'template': ('' if template is None else template),'speaker': ('' if speaker is None else speaker),'duration': ('' if duration is None else duration),'startTime': ('' if startTime is None else startTime),'tags': ('' if tags is None else tags)} ) def updateEvent (self,id,presentationTitle,template,speaker,duration,startTime,tags): return make_request( verb = 'POST', url = 'scheduler/{id}'.format(id=('' if id is None else id)), data = {'presentationTitle': ('' if presentationTitle is None else presentationTitle),'template': ('' if template is None else template),'speaker': ('' if speaker is None else speaker),'duration': ('' if duration is None else duration),'startTime': ('' if startTime is None else startTime),'tags': ('' if tags is None else tags)} ) def getEvent (self,id): return make_request( verb = 'get', url = 'scheduler/{id}'.format(id=('' if id is None else id)), data = {} ) def getEvents (self,speaker,range,rangeStart=None,rangeEnd=None): return make_request( verb = 'get', url = 'scheduler'.format(), data = {'speaker': ('' if speaker is None else speaker),'range': ('' if range is None else range),'rangeStart': ('' if rangeStart is None else rangeStart),'rangeEnd': ('' if rangeEnd is None else rangeEnd)} ) def deleteEvent (self,id): return make_request( verb = 'delete', url = 'scheduler/events/{id}'.format(id=('' if id is None else id)), data = {} ) def createEventGroup (self,presentationTitle,template,speaker,duration,startTime,recurrenceEnd,days,tags): return make_request( verb = 'POST', url = 'scheduler/groups'.format(), data = {'presentationTitle': ('' if presentationTitle is None else presentationTitle),'template': ('' if template is None else template),'speaker': ('' if speaker is None else speaker),'duration': ('' if duration is None else duration),'startTime': ('' if startTime is None else startTime),'recurrenceEnd': ('' if recurrenceEnd is None else recurrenceEnd),'days': ('' if days is None else days),'tags': ('' if tags is None else tags)} ) def updateEventGroup (self,id,presentationTitle,template,speaker,duration,startTime,recurrenceEnd,days,tags): return make_request( verb = 'POST', url = 'scheduler/groups/{id}'.format(id=('' if id is None else id)), data = {'presentationTitle': ('' if presentationTitle is None else presentationTitle),'template': ('' if template is None else template),'speaker': ('' if speaker is None else speaker),'duration': ('' if duration is None else duration),'startTime': ('' if startTime is None else startTime),'recurrenceEnd': ('' if recurrenceEnd is None else recurrenceEnd),'days': ('' if days is None else days),'tags': ('' if tags is None else tags)} ) def getEventGroup (self,id): return make_request( verb = 'get', url = 'scheduler/groups/{id}'.format(id=('' if id is None else id)), data = {} ) def getEventsForGroup (self,id): return make_request( verb = 'get', url = 'scheduler/groups/{id}/events'.format(id=('' if id is None else id)), data = {} ) def deleteEventGroup (self,id): return make_request( verb = 'delete', url = 'scheduler/groups/{id}'.format(id=('' if id is None else id)), data = {} ) self.scheduler = scheduler() class speakers (object): def getSpeakers (self): return make_request( verb = 'get', url = 'speakers'.format(), data = {} ) def createSpeaker (self,name,email,bio,credentials=None,rss=None): return make_request( verb = 'post', url = 'speakers'.format(), data = {'name': ('' if name is None else name),'email': ('' if email is None else email),'bio': ('' if bio is None else bio),'credentials': ('' if credentials is None else credentials),'rss': ('' if rss is None else rss)} ) def updateSpeaker (self,id,name=None,email=None,bio=None,credentials=None,rss=None): return make_request( verb = 'post', url = 'speakers/{id}'.format(id=('' if id is None else id)), data = {'name': ('' if name is None else name),'email': ('' if email is None else email),'bio': ('' if bio is None else bio),'credentials': ('' if credentials is None else credentials),'rss': ('' if rss is None else rss)} ) def deleteSpeaker (self,id): return make_request( verb = 'delete', url = 'speakers/{id}'.format(id=('' if id is None else id)), data = {} ) self.speakers = speakers() class liveStreamViewer (object): def getPreviewForCurrentRecording (self): return make_request( verb = 'GET', url = 'capture/preview'.format(), data = {} ) def getPreviewForVideoDevice (self,deviceId): return make_request( verb = 'GET', url = 'devices/video/{deviceId}/preview'.format(deviceId=('' if deviceId is None else deviceId)), data = {} ) def getPreviewForAudioDevice (self,deviceId): return make_request( verb = 'GET', url = 'devices/audio/{deviceId}/preview'.format(deviceId=('' if deviceId is None else deviceId)), data = {} ) def createPreviewForVideoDevice (self,deviceId): return make_request( verb = 'POST', url = 'devices/video/{deviceId}/preview'.format(deviceId=('' if deviceId is None else deviceId)), data = {} ) def createPreviewForAudioDevice (self,deviceId): return make_request( verb = 'POST', url = 'devices/audio/{deviceId}/preview'.format(deviceId=('' if deviceId is None else deviceId)), data = {} ) self.liveStreamViewer = liveStreamViewer()