GitHub release CI Codecov status License: MIT Contributors

InputStream Helper

script.module.inputstreamhelper is a simple Kodi module that makes life easier for add-on developers relying on InputStream based add-ons and DRM playback.

Features

Example

# -*- coding: utf-8 -*-
"""InputStream Helper Demo"""
from __future__ import absolute_import, division, unicode_literals
import sys
import inputstreamhelper
import xbmc
import xbmcgui
import xbmcplugin

PROTOCOL = 'mpd'
DRM = 'com.widevine.alpha'
STREAM_URL = 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-dash-widevine.ism/.mpd'
MIME_TYPE = 'application/dash+xml'
LICENSE_URL = 'https://widevine-proxy.appspot.com/proxy'
KODI_VERSION_MAJOR = int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0])

def run(addon_url):
    """Run InputStream Helper Demo"""

    # Play video
    if addon_url.endswith('/play'):
        is_helper = inputstreamhelper.Helper(PROTOCOL, drm=DRM)
        if is_helper.check_inputstream():
            play_item = xbmcgui.ListItem(path=STREAM_URL)
            play_item.setContentLookup(False)
            play_item.setMimeType(MIME_TYPE)

            if KODI_VERSION_MAJOR >= 19:
                play_item.setProperty('inputstream', is_helper.inputstream_addon)
            else:
                play_item.setProperty('inputstreamaddon', is_helper.inputstream_addon)

            play_item.setProperty('inputstream.adaptive.manifest_type', PROTOCOL)
            play_item.setProperty('inputstream.adaptive.license_type', DRM)
            play_item.setProperty('inputstream.adaptive.license_key', LICENSE_URL + '||R{SSM}|')
            xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, play_item)

    # Setup menu item
    else:
        xbmcplugin.setContent(int(sys.argv[1]), 'videos')
        list_item = xbmcgui.ListItem(label='InputStream Helper Demo')
        list_item.setProperty('IsPlayable', 'true')
        url = addon_url + '/play'
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, list_item)
        xbmcplugin.endOfDirectory(int(sys.argv[1]))

if __name__ == '__main__':
    run(sys.argv[0])

The Helper class takes two arguments: protocol (the media streaming protocol) and the optional argument 'drm'.

It is recommended to not add your InputStream add-on as a dependency in addon.xml. It can cause confusion with users not being able to install your add-on because the InputStream add-on is disabled. InputStream Helper addresses issues such as these and helps the user to install/enable required InputStream components.

Accepted protocol arguments:

Accepted drm arguments:

Support

Please report any issues or bug reports on the GitHub Issues page.

License

This module is licensed under the The MIT License. Please see the LICENSE.txt file for details.

Releases

v0.5.0 (2020-06-25)

v0.4.7 (2020-05-03)

v0.4.6 (2020-04-29)

v0.4.5 (2020-04-07)

v0.4.4 (2020-03-01)

v0.4.3 (2019-09-25)

v0.4.2 (2019-09-03)

v0.4.1 (2019-09-01)

v0.4.0 (2019-09-01)

v0.3.5 (2019-08-15)

v0.3.4 (2019-03-23)

v0.3.3 (2018-02-21)

v0.3.2 (2018-01-30)

v0.3.1 (2018-01-29)

v0.3.0 (2018-01-29)

v0.2.4 (2018.01.01)

v0.2.3 (2017-12-30)

v0.2.2 (2017-12-05)

v0.2.1 (2017-10-15)

v0.2.0 (2017-09-29)

v0.1.0 (2017-09-13)