Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 121ea88

Browse files
Use inputstream.adaptive for playback (#25)
1 parent 78bfae2 commit 121ea88

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

addon.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<import addon="script.module.pysocks" version="1.6.8" optional="true"/>
77
<import addon="script.module.requests" version="2.22.0"/>
88
<import addon="script.module.routing" version="0.2.0"/>
9+
<import addon="inputstream.adaptive" version="2.4.3"/>
910
</requires>
1011
<extension point="xbmc.python.pluginsource" library="addon_entry.py">
1112
<provides>video</provides>

resources/lib/kodiutils.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import absolute_import, division, unicode_literals
55

66
import logging
7-
87
import xbmc
98
import xbmcaddon
109
import xbmcgui
@@ -118,7 +117,7 @@ def url_for(name, *args, **kwargs):
118117

119118

120119
def show_listing(title_items, category=None, sort=None, content=None, cache=True):
121-
""" Show a virtual directory in Kodi """
120+
"""Show a virtual directory in Kodi"""
122121
from resources.lib.addon import routing
123122

124123
if content:
@@ -200,11 +199,20 @@ def play(stream, title=None, art_dict=None, info_dict=None, prop_dict=None):
200199
if prop_dict:
201200
play_item.setProperties(prop_dict)
202201

202+
# Setup Inputstream Adaptive
203+
if kodi_version_major() >= 19:
204+
play_item.setProperty('inputstream', 'inputstream.adaptive')
205+
else:
206+
play_item.setProperty('inputstreamaddon', 'inputstream.adaptive')
207+
play_item.setProperty('inputstream.adaptive.manifest_type', 'hls')
208+
play_item.setMimeType('application/vnd.apple.mpegurl')
209+
play_item.setContentLookup(False)
210+
203211
xbmcplugin.setResolvedUrl(routing.handle, True, listitem=play_item)
204212

205213

206214
def get_search_string(heading='', message=''):
207-
""" Ask the user for a search string """
215+
"""Ask the user for a search string"""
208216
search_string = None
209217
keyboard = xbmc.Keyboard(message, heading)
210218
keyboard.doModal()
@@ -265,15 +273,15 @@ def create(self, heading, message=''): # pylint: disable=arguments-differ
265273
"""Create and show a progress dialog"""
266274
if kodi_version_major() < 19:
267275
lines = message.split('\n', 2)
268-
line1, line2, line3 = (lines + [None] * (3-len(lines)))
276+
line1, line2, line3 = (lines + [None] * (3 - len(lines)))
269277
return super(progress, self).create(heading, line1=line1, line2=line2, line3=line3)
270278
return super(progress, self).create(heading, message=message)
271279

272280
def update(self, percent, message=''): # pylint: disable=arguments-differ
273281
"""Update the progress dialog"""
274282
if kodi_version_major() < 19:
275283
lines = message.split('\n', 2)
276-
line1, line2, line3 = (lines + [None] * (3-len(lines)))
284+
line1, line2, line3 = (lines + [None] * (3 - len(lines)))
277285
return super(progress, self).update(percent, line1=line1, line2=line2, line3=line3)
278286
return super(progress, self).update(percent, message=message)
279287

0 commit comments

Comments
 (0)