Repository: globocom/m3u8

Issue:
stream_info.closed_captions returns "cc" instead of cc
stream_info.closed_captions returns "cc" instead of cc without quotation marks

```
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768647,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=480x270,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
http://10.129.6.151:8080/dump/video_4/video_4.m3u8
```

Comments:

Patch:
diff --git a/m3u8/parser.py b/m3u8/parser.py
index cc9a76a..9b2a44e 100644
--- a/m3u8/parser.py
+++ b/m3u8/parser.py
@@ -237,7 +237,7 @@ def _parse_attribute_list(prefix, line, atribute_parser):
 def _parse_stream_inf(line, data, state):
     data['is_variant'] = True
     data['media_sequence'] = None
-    atribute_parser = remove_quotes_parser('codecs', 'audio', 'video', 'subtitles')
+    atribute_parser = remove_quotes_parser('codecs', 'audio', 'video', 'subtitles', 'closed_captions')
     atribute_parser["program_id"] = int
     atribute_parser["bandwidth"] = lambda x: int(float(x))
     atribute_parser["average_bandwidth"] = int


Test patch:
diff --git a/tests/playlists.py b/tests/playlists.py
index 9ca09f2..fbec958 100755
--- a/tests/playlists.py
+++ b/tests/playlists.py
@@ -88,6 +88,14 @@ http://example.com/hi.m3u8
 http://example.com/audio-only.m3u8
 '''
 
+VARIANT_PLAYLIST_WITH_CC_SUBS_AND_AUDIO = '''
+#EXTM3U
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
+http://example.com/with-cc-hi.m3u8
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
+http://example.com/with-cc-low.m3u8
+'''
+
 VARIANT_PLAYLIST_WITH_AVERAGE_BANDWIDTH = '''
 #EXTM3U
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1252345
diff --git a/tests/test_parser.py b/tests/test_parser.py
index ff3d826..bd67a59 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -115,6 +115,28 @@ def test_should_parse_variant_playlist():
     assert 65000 == playlists_list[-1]['stream_info']['bandwidth']
     assert 'mp4a.40.5,avc1.42801e' == playlists_list[-1]['stream_info']['codecs']
 
+def test_should_parse_variant_playlist_with_cc_subtitles_and_audio():
+    data = m3u8.parse(playlists.VARIANT_PLAYLIST_WITH_CC_SUBS_AND_AUDIO)
+    playlists_list = list(data['playlists'])
+
+    assert True == data['is_variant']
+    assert None == data['media_sequence']
+    assert 2 == len(playlists_list)
+
+    assert 'http://example.com/with-cc-hi.m3u8' == playlists_list[0]['uri']
+    assert 1 == playlists_list[0]['stream_info']['program_id']
+    assert 7680000 == playlists_list[0]['stream_info']['bandwidth']
+    assert 'cc' == playlists_list[0]['stream_info']['closed_captions']
+    assert 'sub' == playlists_list[0]['stream_info']['subtitles']
+    assert 'aud' == playlists_list[0]['stream_info']['audio']
+
+    assert 'http://example.com/with-cc-low.m3u8' == playlists_list[-1]['uri']
+    assert 1 == playlists_list[-1]['stream_info']['program_id']
+    assert 65000 == playlists_list[-1]['stream_info']['bandwidth']
+    assert 'cc' == playlists_list[-1]['stream_info']['closed_captions']
+    assert 'sub' == playlists_list[-1]['stream_info']['subtitles']
+    assert 'aud' == playlists_list[-1]['stream_info']['audio']
+
 def test_should_parse_variant_playlist_with_average_bandwidth():
     data = m3u8.parse(playlists.VARIANT_PLAYLIST_WITH_AVERAGE_BANDWIDTH)
     playlists_list = list(data['playlists'])