Skip to content

Commit 090691b

Browse files
committed
Autoinstall Widevine updates
This adds a feature to enable automatic installation of Widevine.
1 parent defc09a commit 090691b

File tree

6 files changed

+122
-68
lines changed

6 files changed

+122
-68
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ __pycache__/
55
*.py[cod]
66
test/cdm/
77
test/userdata/addon_settings.json
8+
test/userdata/addon_data/
89
test/userdata/cdm/
910
test/userdata/tmp/
1011

.pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ disable=
55
import-outside-toplevel,
66
line-too-long,
77
old-style-class,
8+
too-many-arguments,
89
too-many-branches,
910
too-many-lines,
1011
too-many-return-statements,

lib/inputstreamhelper/__init__.py

+67-65
Large diffs are not rendered by default.

lib/inputstreamhelper/kodiutils.py

+51-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
''' Implements Kodi Helper functions '''
55
from __future__ import absolute_import, division, unicode_literals
66
import xbmc
7-
from xbmcgui import Dialog
87
from xbmcaddon import Addon
98
from .unicodehelper import from_unicode, to_unicode
109

@@ -34,6 +33,56 @@ def has_socks():
3433
return has_socks.installed
3534

3635

36+
def browsesingle(type, heading, shares='', mask='', useThumbs=False, treatAsFolder=False, defaultt=None): # pylint: disable=invalid-name,redefined-builtin
37+
''' Show a Kodi browseSingle dialog '''
38+
from xbmcgui import Dialog
39+
if not heading:
40+
heading = ADDON.getAddonInfo('name')
41+
return Dialog().browseSingle(type=type, heading=heading, shares=shares, mask=mask, useThumbs=useThumbs, treatAsFolder=treatAsFolder, defaultt=defaultt)
42+
43+
44+
def notification(heading='', message='', icon='info', time=4000):
45+
''' Show a Kodi notification '''
46+
from xbmcgui import Dialog
47+
if not heading:
48+
heading = ADDON.getAddonInfo('name')
49+
return Dialog().notification(heading=heading, message=message, icon=icon, time=time)
50+
51+
52+
def ok_dialog(heading='', message='', autoanswer=None):
53+
''' Show Kodi's OK dialog '''
54+
if autoanswer is not None and get_setting('automatic_install') == 'true':
55+
return autoanswer
56+
from xbmcgui import Dialog
57+
if not heading:
58+
heading = ADDON.getAddonInfo('name')
59+
return Dialog().ok(heading=heading, line1=message)
60+
61+
62+
def progress_dialog():
63+
''' Show Kodi's Progress dialog '''
64+
from xbmcgui import DialogProgress
65+
return DialogProgress()
66+
67+
68+
def textviewer(heading='', text='', usemono=False):
69+
''' Show a Kodi textviewer dialog '''
70+
from xbmcgui import Dialog
71+
if not heading:
72+
heading = ADDON.getAddonInfo('name')
73+
return Dialog().textviewer(heading=heading, text=text, usemono=usemono)
74+
75+
76+
def yesno_dialog(heading='', message='', nolabel=None, yeslabel=None, autoclose=0, autoanswer=None):
77+
''' Show Kodi's Yes/No dialog '''
78+
if autoanswer is not None and get_setting('automatic_install') == 'true':
79+
return autoanswer
80+
from xbmcgui import Dialog
81+
if not heading:
82+
heading = ADDON.getAddonInfo('name')
83+
return Dialog().yesno(heading=heading, line1=message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
84+
85+
3786
def localize(string_id, **kwargs):
3887
''' Return the translated string from the .po language files, optionally translating variables '''
3988
if kwargs:
@@ -82,7 +131,7 @@ def get_proxies():
82131
if httpproxytype != 0 and not socks_supported:
83132
# Only open the dialog the first time (to avoid multiple popups)
84133
if socks_supported is None:
85-
Dialog().ok('', localize(30042)) # Requires PySocks
134+
ok_dialog('', localize(30042)) # Requires PySocks
86135
return None
87136

88137
proxy_types = ['http', 'socks4', 'socks4a', 'socks5', 'socks5h']

resources/settings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<setting label="30904" type="text" id="warning" enable="false"/> <!-- disabled_warning -->
1111
<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"/>
1212
<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"/>
13+
<setting label="Auto-install Widevine CDM" type="bool" id="automatic_install" default="false"/>
1314
<setting type="sep" visible="!system.platform.android"/>
1415
<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"/>
1516
<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"/>

test/xbmcgui.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def textviewer(heading, text=None, usemono=None):
5858
print('\033[37;44;1mTEXTVIEWER:\033[35;49;1m [%s]\n\033[37;1m%s\033[39;0m' % (heading, text))
5959

6060
@staticmethod
61-
def browseSingle(type, heading, shares, mask=None, useThumbs=None, treatAsFolder=None, default=None): # pylint: disable=redefined-builtin
61+
def browseSingle(type, heading, shares, mask=None, useThumbs=None, treatAsFolder=None, defaultt=None): # pylint: disable=redefined-builtin
6262
''' A stub implementation for the xbmcgui Dialog class browseSingle() method '''
6363
print('\033[37;44;1mBROWSESINGLE:\033[35;49;1m [%s] \033[37;1m%s\033[39;0m' % (type, heading))
6464
return 'special://masterprofile/addon_data/script.module.inputstreamhelper/'

0 commit comments

Comments
 (0)