Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/inputstreamhelper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ def _install_widevine_arm(self): # pylint: disable=too-many-statements
return ''
required_diskspace = int(arm_device['filesize']) + int(arm_device['zipfilesize'])
if yesno_dialog(localize(30001), # Due to distributing issues, this takes a long time
localize(30006, diskspace=self._sizeof_fmt(required_diskspace))) and self._widevine_eula():
localize(30006, diskspace=self._sizeof_fmt(required_diskspace)),
autoanswer=True) and self._widevine_eula():
if system_os() != 'Linux':
ok_dialog(localize(30004), localize(30019, os=system_os()))
return False
Expand Down Expand Up @@ -614,7 +615,7 @@ def _install_widevine_arm(self): # pylint: disable=too-many-statements

if os.getuid() != 0 and not yesno_dialog(localize(30001), # Ask for permission to run cmds as root
localize(30030, cmds=', '.join(root_cmds)),
nolabel=localize(30028), yeslabel=localize(30027)):
nolabel=localize(30028), yeslabel=localize(30027), autoanswer=True):
return False

# Clean up any remaining mounts
Expand Down Expand Up @@ -720,7 +721,7 @@ def _update_widevine(self):

if LooseVersion(latest_version) > LooseVersion(current_version):
log('There is an update available for {component}', component=component)
if yesno_dialog(localize(30040), localize(30033), nolabel=localize(30028), yeslabel=localize(30034)):
if yesno_dialog(localize(30040), localize(30033), nolabel=localize(30028), yeslabel=localize(30034), autoanswer=True):
self.install_widevine()
else:
log('User declined to update {component}.', component=component)
Expand All @@ -745,7 +746,7 @@ def _widevine_eula(self):
with archive.open(config.WIDEVINE_LICENSE_FILE) as file_obj:
eula = file_obj.read().decode().strip().replace('\n', ' ')

return yesno_dialog(localize(30026), eula, nolabel=localize(30028), yeslabel=localize(30027)) # Widevine CDM EULA
return yesno_dialog(localize(30026), eula, nolabel=localize(30028), yeslabel=localize(30027), autoanswer=True) # Widevine CDM EULA

def _extract_widevine_from_img(self):
''' Extract the Widevine CDM binary from the mounted Chrome OS image '''
Expand Down Expand Up @@ -887,7 +888,7 @@ def _check_drm(self):
if self._has_widevine():
return self._check_widevine()

if yesno_dialog(localize(30041), localize(30002), nolabel=localize(30028), yeslabel=localize(30038)): # Widevine required
if yesno_dialog(localize(30041), localize(30002), nolabel=localize(30028), yeslabel=localize(30038), autoanswer=True): # Widevine required
return self.install_widevine()

return False
Expand Down
8 changes: 6 additions & 2 deletions lib/inputstreamhelper/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def notification(heading='', message='', icon='info', time=4000):
return Dialog().notification(heading=heading, message=message, icon=icon, time=time)


def ok_dialog(heading='', message=''):
def ok_dialog(heading='', message='', autoanswer=None):
''' Show Kodi's OK dialog '''
if autoanswer is not None and get_setting('automatic_install') == 'true':
return autoanswer
from xbmcgui import Dialog
if not heading:
heading = ADDON.getAddonInfo('name')
Expand All @@ -71,8 +73,10 @@ def textviewer(heading='', text='', usemono=False):
return Dialog().textviewer(heading=heading, text=text, usemono=usemono)


def yesno_dialog(heading='', message='', nolabel=None, yeslabel=None, autoclose=0):
def yesno_dialog(heading='', message='', nolabel=None, yeslabel=None, autoclose=0, autoanswer=None):
''' Show Kodi's Yes/No dialog '''
if autoanswer is not None and get_setting('automatic_install') == 'true':
return autoanswer
from xbmcgui import Dialog
if not heading:
heading = ADDON.getAddonInfo('name')
Expand Down
1 change: 1 addition & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<setting label="30904" type="text" id="warning" enable="false"/> <!-- disabled_warning -->
<setting label="30905" help="30906" type="slider" id="update_frequency" default="31" range="1,3,90" option="int" enable="eq(-2,false)" visible="!system.platform.android"/>
<setting label="30907" help="30908" type="folder" id="temp_path" source="" option="writeable" default="special://masterprofile/addon_data/script.module.inputstreamhelper" visible="!system.platform.android"/>
<setting label="Auto-install Widevine CDM" type="bool" id="automatic_install" default="false"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Unattended Widevine CDM install" is a better description.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

<setting type="sep" visible="!system.platform.android"/>
<setting label="30909" help="30910" type="action" id="install_widevine" action="RunScript(script.module.inputstreamhelper, widevine_install)" enable="System.HasAddon(inputstream.adaptive)" visible="!system.platform.android"/>
<setting label="30911" help="30912" type="action" id="remove_widevine" action="RunScript(script.module.inputstreamhelper, widevine_remove)" enable="System.HasAddon(inputstream.adaptive)" visible="!system.platform.android"/>
Expand Down