Fixes Issue #2 #4

Merged
dafo5502 merged 59 commits from developer into master 2021-10-25 14:41:37 +02:00
Showing only changes of commit 808cbcfb3c - Show all commits

View File

@ -61,7 +61,7 @@ class Mediasite:
'playAudio': source['playAudio']} 'playAudio': source['playAudio']}
mypackage['sources'].append(mysource) mypackage['sources'].append(mysource)
# Slides exist, create a package for creating a video from the slides
if 'slides' in data: if 'slides' in data:
slides_path = os.path.join(base, 'slides') slides_path = os.path.join(base, 'slides')
os.mkdir(slides_path) os.mkdir(slides_path)
@ -76,15 +76,15 @@ class Mediasite:
# loop all slides and download, calculate the duration and create a text file holding all the info for he ffmpeg demuxer # loop all slides and download, calculate the duration and create a text file holding all the info for he ffmpeg demuxer
for i in range(num_slides): for i in range(num_slides):
# Download the source file and change the url to a local file path # Download the source file and store the url as a local file path
myslide['url'] = os.path.join(slides_path, self._download(slides_path, data['slides'][i]['url'], session)) myslide['url'] = os.path.join(slides_path, self._download(slides_path, data['slides'][i]['url'], session))
# Handle the different edgecases for indiviual slide duration # Handle the different edgecases for indiviual slide duration
if i == num_slides - 1: if i == num_slides - 1: # last slide
myslide['duration'] = '{}ms'.format(data['duration'] - int(data['slides'][i]['duration'])) myslide['duration'] = '{}ms'.format(data['duration'] - int(data['slides'][i]['duration']))
elif i == 0: elif i == 0: # first slide
myslide['duration'] = '{}ms'.format(int(data['slides'][i+1]['duration'])) myslide['duration'] = '{}ms'.format(int(data['slides'][i+1]['duration']))
else: else: # all other slides
myslide['duration'] = '{}ms'.format(int(data['slides'][i+1]['duration']) - int(data['slides'][i]['duration'])) myslide['duration'] = '{}ms'.format(int(data['slides'][i+1]['duration']) - int(data['slides'][i]['duration']))
# Commit to the demuxfile. Duration is assumed to be seconds unless staded otherwise # Commit to the demuxfile. Duration is assumed to be seconds unless staded otherwise
@ -99,7 +99,7 @@ class Mediasite:
# put all the slides info in mypackage for the transcoder to rework into a mp4 video # put all the slides info in mypackage for the transcoder to rework into a mp4 video
mypackage['sources'].append({'demux_file': demux_file, mypackage['sources'].append({'demux_file': demux_file,
'poster': slides[-1]['url'], 'poster': slides[0]['url'],
'playAudio': False }) 'playAudio': False })
return mypackage return mypackage