예제 #1
0
def get_inputstream_listitem(videoid):
    """Return a listitem that has all inputstream relevant properties set for playback of the given video_id"""
    service_url = 'http://127.0.0.1:{}'.format(
        G.LOCAL_DB.get_value('nf_server_service_port'))
    manifest_path = MANIFEST_PATH_FORMAT.format(videoid.value)
    list_item = xbmcgui.ListItem(path=service_url + manifest_path,
                                 offscreen=True)
    list_item.setContentLookup(False)
    list_item.setMimeType('application/xml+dash')
    list_item.setProperty('IsPlayable', 'true')
    try:
        import inputstreamhelper
        is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
        inputstream_ready = is_helper.check_inputstream()
    except Exception as exc:  # pylint: disable=broad-except
        # Captures all types of ISH internal errors
        import traceback
        LOG.error(traceback.format_exc())
        raise InputStreamHelperError(str(exc)) from exc
    if not inputstream_ready:
        raise Exception(common.get_local_string(30046))
    list_item.setProperty(key='inputstream.adaptive.stream_headers',
                          value='user-agent=' + common.get_user_agent())
    list_item.setProperty(key='inputstream.adaptive.license_type',
                          value='com.widevine.alpha')
    list_item.setProperty(key='inputstream.adaptive.manifest_type',
                          value='mpd')
    list_item.setProperty(key='inputstream.adaptive.license_key',
                          value=service_url +
                          LICENSE_PATH_FORMAT.format(videoid.value) +
                          '||b{SSM}!b{SID}|')
    list_item.setProperty(key='inputstream.adaptive.server_certificate',
                          value=INPUTSTREAM_SERVER_CERTIFICATE)
    list_item.setProperty(key='inputstream', value='inputstream.adaptive')
    return list_item
예제 #2
0
def get_inputstream_listitem(videoid):
    """Return a listitem that has all inputstream relevant properties set for playback of the given video_id"""
    service_url = SERVICE_URL_FORMAT.format(
        port=G.LOCAL_DB.get_value('msl_service_port', 8000))
    manifest_path = MANIFEST_PATH_FORMAT.format(videoid=videoid.value)
    list_item = xbmcgui.ListItem(path=service_url + manifest_path,
                                 offscreen=True)
    list_item.setContentLookup(False)
    list_item.setMimeType('application/xml+dash')
    list_item.setProperty('isFolder', 'false')
    list_item.setProperty('IsPlayable', 'true')
    try:
        import inputstreamhelper
        is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
        inputstream_ready = is_helper.check_inputstream()
        if not inputstream_ready:
            raise Exception(common.get_local_string(30046))

        list_item.setProperty(key=is_helper.inputstream_addon +
                              '.stream_headers',
                              value='user-agent=' + common.get_user_agent())
        list_item.setProperty(key=is_helper.inputstream_addon +
                              '.license_type',
                              value='com.widevine.alpha')
        list_item.setProperty(key=is_helper.inputstream_addon +
                              '.manifest_type',
                              value='mpd')
        list_item.setProperty(
            key=is_helper.inputstream_addon + '.license_key',
            value=service_url +
            LICENSE_PATH_FORMAT.format(videoid=videoid.value) +
            '||b{SSM}!b{SID}|')
        list_item.setProperty(key=is_helper.inputstream_addon +
                              '.server_certificate',
                              value=INPUTSTREAM_SERVER_CERTIFICATE)
        list_item.setProperty(
            key='inputstreamaddon'
            if G.KODI_VERSION.is_major_ver('18') else 'inputstream',
            value=is_helper.inputstream_addon)
        return list_item
    except Exception as exc:  # pylint: disable=broad-except
        # Captures all types of ISH internal errors
        import traceback
        LOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))
        raise_from(InputStreamHelperError(str(exc)), exc)
def _set_isa_addon_settings(is_4k_capable, hdcp_override):
    """Method for self-configuring of InputStream Adaptive add-on"""
    try:
        is_helper = inputstreamhelper.Helper('mpd')
        if not is_helper.check_inputstream():
            show_ok_dialog(get_local_string(30154), get_local_string(30046))
            return
    except Exception as exc:  # pylint: disable=broad-except
        # Captures all types of ISH internal errors
        import traceback
        LOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))
        raise_from(InputStreamHelperError(str(exc)), exc)

    isa_addon = Addon('inputstream.adaptive')
    isa_addon.setSettingBool('HDCPOVERRIDE', hdcp_override)
    if isa_addon.getSettingInt('STREAMSELECTION') == 1:
        # Stream selection must never be set to 'Manual' or cause problems with the streams
        isa_addon.setSettingInt('STREAMSELECTION', 0)
    # 'Ignore display' should only be set when Kodi display resolution is not 4K
    isa_addon.setSettingBool('IGNOREDISPLAY', is_4k_capable and (getScreenWidth() != 3840 or getScreenHeight() != 2160))
예제 #4
0
def get_inputstream_listitem(videoid):
    """Return a listitem that has all inputstream relevant properties set for playback of the given video_id"""
    service_url = f'http://127.0.0.1:{G.LOCAL_DB.get_value("nf_server_service_port")}'
    manifest_path = MANIFEST_PATH_FORMAT.format(videoid.value)
    list_item = xbmcgui.ListItem(path=service_url + manifest_path,
                                 offscreen=True)
    list_item.setContentLookup(False)
    list_item.setMimeType('application/xml+dash')
    list_item.setProperty('IsPlayable', 'true')
    # Allows the add-on to always have play callbacks also when using the playlist (Kodi versions >= 20)
    list_item.setProperty('ForceResolvePlugin', 'true')
    try:
        import inputstreamhelper
        is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
        inputstream_ready = is_helper.check_inputstream()
    except Exception as exc:  # pylint: disable=broad-except
        # Captures all types of ISH internal errors
        import traceback
        LOG.error(traceback.format_exc())
        raise InputStreamHelperError(str(exc)) from exc
    if not inputstream_ready:
        raise Exception(common.get_local_string(30046))
    list_item.setProperty(key='inputstream.adaptive.stream_headers',
                          value=f'user-agent={common.get_user_agent()}')
    list_item.setProperty(key='inputstream.adaptive.license_type',
                          value='com.widevine.alpha')
    list_item.setProperty(key='inputstream.adaptive.manifest_type',
                          value='mpd')
    list_item.setProperty(key='inputstream.adaptive.license_key',
                          value=service_url +
                          LICENSE_PATH_FORMAT.format(videoid.value) +
                          '||b{SSM}!b{SID}|')
    list_item.setProperty(key='inputstream.adaptive.server_certificate',
                          value=INPUTSTREAM_SERVER_CERTIFICATE)
    list_item.setProperty(key='inputstream', value='inputstream.adaptive')
    # Set PSSH/KID to pre-initialize the DRM to get challenge/session ID data in the ISA manifest proxy callback
    if common.get_system_platform() != 'android':
        list_item.setProperty(key='inputstream.adaptive.pre_init_data',
                              value=PSSH_KID)
    return list_item