VisibilityHandler #3
|
@ -49,6 +49,7 @@ canonical_manifest = {
|
||||||
'subtitles': {str: str},
|
'subtitles': {str: str},
|
||||||
'sources': {str: {'poster': str,
|
'sources': {str: {'poster': str,
|
||||||
'playAudio': bool,
|
'playAudio': bool,
|
||||||
|
'enabled': bool,
|
||||||
'video': {'720': str,
|
'video': {'720': str,
|
||||||
'1080': str}}}
|
'1080': str}}}
|
||||||
}
|
}
|
||||||
|
|
21
test.py
21
test.py
|
@ -300,7 +300,7 @@ class PipelineTest(DaemonTest):
|
||||||
return final_result
|
return final_result
|
||||||
|
|
||||||
def init_job(self, pkgid=False, url=False, subs=False, thumb=False,
|
def init_job(self, pkgid=False, url=False, subs=False, thumb=False,
|
||||||
source_count=0, poster_count=0):
|
source_count=0, disabled_source_count=0, poster_count=0):
|
||||||
jobspec = {}
|
jobspec = {}
|
||||||
|
|
||||||
if url == True:
|
if url == True:
|
||||||
|
@ -333,7 +333,7 @@ class PipelineTest(DaemonTest):
|
||||||
if source_count:
|
if source_count:
|
||||||
# poster_count determines the number of posters to include.
|
# poster_count determines the number of posters to include.
|
||||||
# Any remaining posters will be generated in pipeline
|
# Any remaining posters will be generated in pipeline
|
||||||
self.add_sources(jobspec, source_count, poster_count)
|
self.add_sources(jobspec, source_count, poster_count, disabled_source_count)
|
||||||
|
|
||||||
return jobspec
|
return jobspec
|
||||||
|
|
||||||
|
@ -343,7 +343,8 @@ class PipelineTest(DaemonTest):
|
||||||
str(uuid.uuid4()))
|
str(uuid.uuid4()))
|
||||||
jobspec['upload_dir'] = uldir
|
jobspec['upload_dir'] = uldir
|
||||||
makedirs(uldir)
|
makedirs(uldir)
|
||||||
return uldir
|
return uldir
|
||||||
|
return jobspec['upload_dir']
|
||||||
|
|
||||||
def add_subtitles(self, jobspec):
|
def add_subtitles(self, jobspec):
|
||||||
uldir = self.ensure_uldir(jobspec)
|
uldir = self.ensure_uldir(jobspec)
|
||||||
|
@ -356,16 +357,22 @@ class PipelineTest(DaemonTest):
|
||||||
copyfile(subspath, path.join(uldir, subsfile))
|
copyfile(subspath, path.join(uldir, subsfile))
|
||||||
jobspec['subtitles'] = subspec
|
jobspec['subtitles'] = subspec
|
||||||
|
|
||||||
def add_sources(self, jobspec, count, poster_count=0):
|
def add_sources(self, jobspec, count, poster_count=0, disabled_count=0):
|
||||||
uldir = self.ensure_uldir(jobspec)
|
uldir = self.ensure_uldir(jobspec)
|
||||||
jobspec['sources'] = {}
|
if 'sources' not in jobspec:
|
||||||
|
jobspec['sources'] = {}
|
||||||
posters = 0
|
posters = 0
|
||||||
|
disabled = 0
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
videopath = next(self.videopaths)
|
videopath = next(self.videopaths)
|
||||||
videofile = path.basename(videopath)
|
videofile = path.basename(videopath)
|
||||||
copyfile(videopath, path.join(uldir, videofile))
|
copyfile(videopath, path.join(uldir, videofile))
|
||||||
sourcedef = {'video': videofile,
|
sourcedef = {'video': videofile,
|
||||||
'playAudio': False}
|
'playAudio': False,
|
||||||
|
'enabled': True}
|
||||||
|
if disabled < disabled_count:
|
||||||
|
sourcedef['enabled'] = False
|
||||||
|
disabled += 1
|
||||||
if i == 0:
|
if i == 0:
|
||||||
sourcedef['playAudio'] = True
|
sourcedef['playAudio'] = True
|
||||||
if posters < poster_count:
|
if posters < poster_count:
|
||||||
|
@ -457,7 +464,7 @@ class PipelineTest(DaemonTest):
|
||||||
|
|
||||||
#@unittest.skip("This test is very slow")
|
#@unittest.skip("This test is very slow")
|
||||||
def test_transcoding(self):
|
def test_transcoding(self):
|
||||||
jobspec = self.init_job(source_count=4, poster_count=2)
|
jobspec = self.init_job(source_count=3, poster_count=2, disabled_source_count=1)
|
||||||
|
|
||||||
jobid = self.submit_default_job(jobspec)
|
jobid = self.submit_default_job(jobspec)
|
||||||
result = self.wait_for_result(jobid, ['AudioHandler',
|
result = self.wait_for_result(jobid, ['AudioHandler',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user