[Python-modules-commits] [python-m3u8] 01/08: Import python-m3u8_0.2.9.orig.tar.gz

Ondrej Koblizek kobla-guest at moszumanska.debian.org
Thu Jul 7 10:37:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

kobla-guest pushed a commit to branch master
in repository python-m3u8.

commit 8faa20e9a801029b1e8007db157edae6df81936e
Author: Ondřej Kobližek <ondrej.koblizek at firma.seznam.cz>
Date:   Thu Jul 7 11:36:48 2016 +0200

    Import python-m3u8_0.2.9.orig.tar.gz
---
 .gitignore                 |  1 +
 MANIFEST.in                |  1 +
 m3u8/model.py              |  9 +++++++--
 setup.py                   |  3 ++-
 tests/playlists.py         | 14 ++++++++++++++
 tests/test_variant_m3u8.py |  6 +++++-
 6 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2ad5a2b..432207e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ tests/server.stdout
 dist/
 build/
 .coverage
+.cache
diff --git a/MANIFEST.in b/MANIFEST.in
index f9bd145..a7da3fc 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,2 @@
 include requirements.txt
+include LICENSE
diff --git a/m3u8/model.py b/m3u8/model.py
index 4ca8c66..05850f5 100644
--- a/m3u8/model.py
+++ b/m3u8/model.py
@@ -505,9 +505,14 @@ class Playlist(BasePathMixin):
         if self.stream_info.codecs:
             stream_inf.append('CODECS=' + quoted(self.stream_info.codecs))
 
+        media_types = []
         for media in self.media:
-            media_type = media.type.upper()
-            stream_inf.append('%s="%s"' % (media_type, media.group_id))
+            if media.type in media_types:
+                continue
+            else:
+                media_types += [media.type]
+                media_type = media.type.upper()
+                stream_inf.append('%s="%s"' % (media_type, media.group_id))
 
         return '#EXT-X-STREAM-INF:' + ','.join(stream_inf) + '\n' + self.uri
 
diff --git a/setup.py b/setup.py
index 260db49..61c2501 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,8 @@ setup(
     name="m3u8",
     author='Globo.com',
     author_email='videos3 at corp.globo.com',
-    version="0.2.8",
+    version="0.2.9",
+    license='MIT',
     zip_safe=False,
     include_package_data=True,
     install_requires=install_reqs,
diff --git a/tests/playlists.py b/tests/playlists.py
index 6bb45fc..e17ae09 100755
--- a/tests/playlists.py
+++ b/tests/playlists.py
@@ -325,6 +325,20 @@ CUE_OUT_PLAYLIST = '''
 
 '''
 
+MULTI_MEDIA_PLAYLIST = '''#EXTM3U
+#EXT-X-VERSION:3
+#EXT-X-MEDIA:URI="chinese/ed.ttml",TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="zho",NAME="Chinese",AUTOSELECT=YES,FORCED=NO
+#EXT-X-MEDIA:URI="french/ed.ttml",TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="fra",NAME="French",AUTOSELECT=YES,FORCED=NO
+#EXT-X-MEDIA:URI="en/chunklist_w370587926_b160000_ao_slen_t64RW5nbGlzaA==.m3u8",TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES
+#EXT-X-MEDIA:URI="sp/chunklist_w370587926_b160000_ao_slsp_t64U3BhbmlzaA==.m3u8",TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="sp",NAME="Spanish",DEFAULT=NO,AUTOSELECT=YES
+#EXT-X-MEDIA:URI="com/chunklist_w370587926_b160000_ao_slen_t64Q29tbWVudGFyeSAoZW5nKQ==.m3u8",TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="Commentary (eng)",DEFAULT=NO,AUTOSELECT=NO
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2962000,RESOLUTION=1280x720,CODECS="avc1.66.30",AUDIO="aac",SUBTITLES="subs"
+1280/chunklist_w370587926_b2962000_vo_slen_t64TWFpbg==.m3u8
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1427000,RESOLUTION=768x432,CODECS="avc1.66.30",AUDIO="aac",SUBTITLES="subs"
+768/chunklist_w370587926_b1427000_vo_slen_t64TWFpbg==.m3u8
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=688000,RESOLUTION=448x252,CODECS="avc1.66.30",AUDIO="aac",SUBTITLES="subs"
+448/chunklist_w370587926_b688000_vo_slen_t64TWFpbg==.m3u8
+'''
 
 RELATIVE_PLAYLIST_FILENAME = abspath(join(dirname(__file__), 'playlists/relative-playlist.m3u8'))
 
diff --git a/tests/test_variant_m3u8.py b/tests/test_variant_m3u8.py
index 811a954..e1f160e 100644
--- a/tests/test_variant_m3u8.py
+++ b/tests/test_variant_m3u8.py
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a MIT License
 # license that can be found in the LICENSE file.
 
-import m3u8
+import m3u8, playlists
 
 def test_create_a_variant_m3u8_with_two_playlists():
     variant_m3u8 = m3u8.M3U8()
@@ -125,3 +125,7 @@ http://example.com/low.m3u8
 http://example.com/high.m3u8
 """
     assert expected_content == variant_m3u8.dumps()
+
+def test_variant_playlist_with_multiple_media():
+    variant_m3u8 = m3u8.loads(playlists.MULTI_MEDIA_PLAYLIST)
+    assert variant_m3u8.dumps() == playlists.MULTI_MEDIA_PLAYLIST

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-m3u8.git



More information about the Python-modules-commits mailing list