Skip to content

Commit 7907cfd

Browse files
author
Alex Schworer
committed
add support for live stream jobs
1 parent 4186a28 commit 7907cfd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

zencoder/core.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,16 @@ def __init__(self, *args, **kwargs):
297297
kwargs['resource_name'] = 'jobs'
298298
super(Job, self).__init__(*args, **kwargs)
299299

300-
def create(self, input, outputs=None, options=None):
300+
def create(self, input=None, live_stream=False, outputs=None, options=None):
301301
"""
302-
Creates a job
302+
Creates a transcoding job.
303303
304304
@param input: the input url as string
305+
@param live_stream: starts an RTMP Live Stream
305306
@param outputs: a list of output dictionaries
306307
@param options: a dictionary of job options
307308
"""
308-
as_test = int(self.test)
309-
310-
data = {"input": input, "test": as_test}
309+
data = {"input": input, "test": self.test}
311310
if outputs:
312311
data['outputs'] = outputs
313312

@@ -364,6 +363,10 @@ def delete(self, job_id):
364363
"""
365364
return self.cancel(job_id)
366365

366+
def finish(self, job_id):
367+
""" Finishes the live stream for `job_id`. """
368+
return self.put(self.base_url + '/%s/finish' % str(job_id))
369+
367370
class Report(HTTPBackend):
368371
def __init__(self, *args, **kwargs):
369372
"""
@@ -404,3 +407,4 @@ def minutes(self, start_date=None, end_date=None, grouping=None):
404407

405408
url = self.base_url + '/minutes'
406409
return self.get(url, data=data)
410+

0 commit comments

Comments
 (0)