Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.python.twitch" name="python-twitch for Kodi" version="1.0.0~beta2" provider-name="A Talented Community">
<addon id="script.module.python.twitch" name="python-twitch for Kodi" version="1.0.0~beta3" provider-name="A Talented Community">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.six" version="1.9.0"/>
Expand Down
2 changes: 2 additions & 0 deletions resources/lib/twitch/api/usher.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def _live(channel, token):
q.add_param(keys.TOKEN, token[keys.TOKEN])
q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
q.add_param(keys.ALLOW_SPECTRE, Boolean.TRUE)
q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
return q


Expand All @@ -62,6 +63,7 @@ def _vod(video_id, token):
q.add_param(keys.NAUTHSIG, token[keys.SIG])
q.add_param(keys.NAUTH, token[keys.TOKEN])
q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
return q


Expand Down
1 change: 1 addition & 0 deletions resources/lib/twitch/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
string constants
"""

ALLOW_AUDIO_ONLY = 'allow_audio_only'
ALLOW_SOURCE = 'allow_source'
ALLOW_SPECTRE = 'allow_spectre'
AVATAR_IMAGE = 'avatar_image'
Expand Down
44 changes: 16 additions & 28 deletions resources/lib/twitch/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,14 @@ def m3u8_to_dict(string):
d = dict()
matches = re.finditer(_m3u_pattern, string)
for m in matches:
if m.group('group_id') == 'chunked':
d[m.group('group_id')] = {
'id': m.group('group_id'),
'name': 'Source',
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
}
else:
d[m.group('group_id')] = {
'id': m.group('group_id'),
'name': m.group('group_name'),
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
}
name = 'Audio Only' if m.group('group_name') == 'audio_only' else m.group('group_name')
name = 'Source' if m.group('group_id') == 'chunked' else name
d[m.group('group_id')] = {
'id': m.group('group_id'),
'name': name,
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
}
log.debug('m3u8_to_dict result:\n{}'.format(d))
return d

Expand All @@ -66,20 +60,14 @@ def m3u8_to_list(string):
l = list()
matches = re.finditer(_m3u_pattern, string)
for m in matches:
if m.group('group_id') == 'chunked':
l.insert(0, {
'id': m.group('group_id'),
'name': 'Source',
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
})
else:
l.append({
'id': m.group('group_id'),
'name': m.group('group_name'),
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
})
name = 'Audio Only' if m.group('group_name') == 'audio_only' else m.group('group_name')
name = 'Source' if m.group('group_id') == 'chunked' else name
l.append({
'id': m.group('group_id'),
'name': name,
'url': m.group('url'),
'bandwidth': int(m.group('bandwidth'))
})

log.debug('m3u8_to_list result:\n{}'.format(l))
return l
Expand Down