本文整理汇总了Python中inputstreamhelper.Helper方法的典型用法代码示例。如果您正苦于以下问题:Python inputstreamhelper.Helper方法的具体用法?Python inputstreamhelper.Helper怎么用?Python inputstreamhelper.Helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inputstreamhelper
的用法示例。
在下文中一共展示了inputstreamhelper.Helper方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_isa_addon_settings
# 需要导入模块: import inputstreamhelper [as 别名]
# 或者: from inputstreamhelper import Helper [as 别名]
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
error(g.py2_decode(traceback.format_exc(), 'latin-1'))
raise InputStreamHelperError(str(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))
示例2: get_inputstream_listitem
# 需要导入模块: import inputstreamhelper [as 别名]
# 或者: from inputstreamhelper import Helper [as 别名]
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()
except Exception as exc: # pylint: disable=broad-except
# Captures all types of ISH internal errors
import traceback
common.error(g.py2_decode(traceback.format_exc(), 'latin-1'))
raise InputStreamHelperError(str(exc))
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
示例3: play
# 需要导入模块: import inputstreamhelper [as 别名]
# 或者: from inputstreamhelper import Helper [as 别名]
def play(item_id, index):
properties = {}
if (
"hls" in plugin.settings.stream_type
and plugin.settings.inputstream_adaptive_enabled == "true"
and inputstreamhelper
):
helper = inputstreamhelper.Helper("hls")
if not helper.check_inputstream():
return
else:
properties.update(
{
"inputstreamaddon": helper.inputstream_addon,
"inputstream.adaptive.manifest_type": "hls",
}
)
playback_data = get_window_property(index)
video_data = playback_data.get("video_data")
video_info = playback_data["video_info"]
if not video_data:
response = plugin.client("items/{}".format(item_id)).get()
video_data = response["item"]["videos"][0]
video_info = extract_video_info(response["item"], video_info)
if "files" not in video_data:
notice("Видео обновляется и временно не доступно!", "Видео в обработке", time=8000)
return
url = get_mlink(
video_data,
quality=plugin.settings.video_quality,
stream_type=plugin.settings.stream_type,
ask_quality=plugin.settings.ask_quality,
)
properties.update(
{
"item_id": item_id,
"play_duration": video_info["duration"],
"play_resumetime": video_info["time"],
"video_number": video_info.get("episode", 1),
"season_number": video_info.get("season", ""),
"playcount": video_info["playcount"],
"imdbnumber": video_info["imdbnumber"],
}
)
li = plugin.list_item(
playback_data["title"],
path=url,
properties=properties,
poster=playback_data["poster"],
subtitles=[subtitle["url"] for subtitle in video_data["subtitles"]],
)
player = Player(list_item=li)
xbmcplugin.setResolvedUrl(plugin.handle, True, li)
while player.is_playing:
player.set_marktime()
xbmc.sleep(1000)
示例4: play
# 需要导入模块: import inputstreamhelper [as 别名]
# 或者: from inputstreamhelper import Helper [as 别名]
def play(stream, video=None):
"""Create a virtual directory listing to play its only item"""
try: # Python 3
from urllib.parse import unquote
except ImportError: # Python 2
from urllib2 import unquote
from xbmcgui import ListItem
from addon import plugin
play_item = ListItem(path=stream.stream_url)
if video and hasattr(video, 'info_dict'):
play_item.setProperty('subtitle', video.label)
play_item.setArt(video.art_dict)
play_item.setInfo(
type='video',
infoLabels=video.info_dict
)
play_item.setProperty('inputstream.adaptive.max_bandwidth', str(get_max_bandwidth() * 1000))
play_item.setProperty('network.bandwidth', str(get_max_bandwidth() * 1000))
if stream.stream_url is not None and stream.use_inputstream_adaptive:
if kodi_version_major() < 19:
play_item.setProperty('inputstreamaddon', 'inputstream.adaptive')
else:
play_item.setProperty('inputstream', 'inputstream.adaptive')
play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd')
play_item.setContentLookup(False)
play_item.setMimeType('application/dash+xml')
if stream.license_key is not None:
import inputstreamhelper
is_helper = inputstreamhelper.Helper('mpd', drm='com.widevine.alpha')
if is_helper.check_inputstream():
play_item.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha')
play_item.setProperty('inputstream.adaptive.license_key', stream.license_key)
subtitles_visible = get_setting_bool('showsubtitles', default=True)
# Separate subtitle url for hls-streams
if subtitles_visible and stream.subtitle_url is not None:
log(2, 'Subtitle URL: {url}', url=unquote(stream.subtitle_url))
play_item.setSubtitles([stream.subtitle_url])
log(1, 'Play: {url}', url=unquote(stream.stream_url))
xbmcplugin.setResolvedUrl(plugin.handle, bool(stream.stream_url), listitem=play_item)
while not xbmc.Player().isPlaying() and not xbmc.Monitor().abortRequested():
xbmc.sleep(100)
xbmc.Player().showSubtitles(subtitles_visible)