Skip to content

Commit

Permalink
Only attempt to import InputStream Helper if necessary #923
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Oct 7, 2024
1 parent 88dd8ce commit 545e71f
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions resources/lib/youtube_plugin/youtube/helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
)


try:
from inputstreamhelper import Helper as ISHelper
except ImportError:
ISHelper = None

__RE_PLAYLIST = re.compile(
r'^(/channel/(?P<channel_id>[^/]+))/playlist/(?P<playlist_id>[^/]+)/?$'
)
Expand Down Expand Up @@ -866,17 +861,23 @@ def update_play_info(provider, context, video_id, media_item, video_stream):

if use_isa:
license_info = video_stream.get('license_info', {})
license_proxy = license_info.get('proxy', '')
license_url = license_info.get('url', '')
license_token = license_info.get('token', '')
license_proxy = license_info.get('proxy')
license_url = license_info.get('url')
license_token = license_info.get('token')

if license_proxy and license_url and license_token:
try:
from inputstreamhelper import Helper

if ISHelper and license_proxy and license_url and license_token:
ISHelper('mpd' if media_item.use_mpd() else 'hls',
drm='com.widevine.alpha').check_inputstream()
is_helper = Helper('mpd' if media_item.use_mpd() else 'hls',
drm='com.widevine.alpha')
except ImportError:
is_helper = None

media_item.set_license_key(license_proxy)
ui.set_property(LICENSE_URL, license_url)
ui.set_property(LICENSE_TOKEN, license_token)
if is_helper and is_helper.check_inputstream():
media_item.set_license_key(license_proxy)
ui.set_property(LICENSE_URL, license_url)
ui.set_property(LICENSE_TOKEN, license_token)


def update_fanarts(provider, context, channel_items_dict, data=None):
Expand Down

0 comments on commit 545e71f

Please sign in to comment.