Exemple #1
0
def test_medialist_uri_method():
    langs = ['English', 'French', 'German']
    ml = MediaList()
    for lang in langs:
        ml.append(Media(type='AUDIO', group_id='audio-group', name=lang, uri=('/%s.m3u8' % lang)))

    assert len(ml.uri) == len(langs)
    assert ml.uri[0] == '/%s.m3u8' % langs[0]
    assert ml.uri[1] == '/%s.m3u8' % langs[1]
    assert ml.uri[2] == '/%s.m3u8' % langs[2]
 def add_base_path_to_playlists(self, paths, initial_manifest):
     medias = MediaList()
     playlists = PlaylistList()
     for i, path in enumerate(paths):
         manifest_path = self.job.output_url + path + self.OUTPUT_FILE_NAME
         manifest = m3u8.loads(self.read_file(manifest_path))
         for playlist in manifest.playlists:
             playlist.uri = path + playlist.uri
             playlists.append(playlist)
         for media in manifest.media:
             media.uri = path + media.uri
             media.group_id += "_{}".format(str(i))
             medias.append(media)
     initial_manifest.media = medias
     initial_manifest.playlists = playlists