Missing cattura enrichment no longer crashes the packager
This commit is contained in:
parent
dd4815523a
commit
d137536f9d
@ -23,7 +23,7 @@ class Mediasite:
|
||||
config['mediasite']['password'])
|
||||
self.chunk_size = 10485760 # 10MiB; seems optimal for speed
|
||||
# Tested 8k, 10MiB and 20MiB
|
||||
self.logger = logging.getLogger('play-daemon')
|
||||
#self.logger = logging.getLogger('play-daemon')
|
||||
|
||||
def pack(self, pres_id, queue_item):
|
||||
data = queue_item['data']
|
||||
@ -206,13 +206,15 @@ class Cattura:
|
||||
media = outputs[key]
|
||||
richfile = self._find_enrichment(
|
||||
media['element']['video']['sourceID'], mediapackage)
|
||||
enrichment = None
|
||||
with open(os.path.join(path, richfile)) as f:
|
||||
enrichment = json.load(f)
|
||||
poster = ''
|
||||
if richfile:
|
||||
with open(os.path.join(path, richfile)) as f:
|
||||
enrichment = json.load(f)
|
||||
poster = self._find_poster(enrichment)
|
||||
|
||||
source = {'name': media['element']['name'],
|
||||
'video': media['file'],
|
||||
'poster': self._find_poster(enrichment),
|
||||
'poster': poster,
|
||||
'playAudio': False}
|
||||
if source['name'] == 'main':
|
||||
source['playAudio'] = True
|
||||
@ -250,9 +252,12 @@ class Cattura:
|
||||
"can't find mediapackage element")
|
||||
|
||||
def _find_enrichment(self, sourceid, mediapackage):
|
||||
_, sourceid = sourceid.split(',')
|
||||
tocid = 'toc:' + sourceid
|
||||
return mediapackage['outputs'][tocid]['file']
|
||||
_, splitid = sourceid.split(',')
|
||||
tocid = 'toc:' + splitid
|
||||
try:
|
||||
return mediapackage['outputs'][tocid]['file']
|
||||
except KeyError:
|
||||
return ''
|
||||
|
||||
def _find_poster(self, enrichment):
|
||||
for frame in enrichment['entries']:
|
||||
|
Loading…
x
Reference in New Issue
Block a user