Skip to content

Commit be79c3e

Browse files
committed
[script.module.inputstreamhelper] 0.8.0
1 parent d4f1315 commit be79c3e

File tree

17 files changed

+173
-145
lines changed

17 files changed

+173
-145
lines changed

script.module.inputstreamhelper/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
```python
2020
# -*- coding: utf-8 -*-
2121
"""InputStream Helper Demo"""
22-
from __future__ import absolute_import, division, unicode_literals
2322
import sys
2423
import inputstreamhelper
2524
import xbmc
@@ -91,6 +90,10 @@ Please report any issues or bug reports on the [GitHub Issues](https://github.co
9190
This module is licensed under the **The MIT License**. Please see the [LICENSE.txt](LICENSE.txt) file for details.
9291

9392
## Releases
93+
### v0.8.0 (2025-09-19)
94+
- Fix Widevine CDM installation on Windows, Linux and Macintosh (@mediaminister)
95+
- Add support for LG webOS (@Uukrull)
96+
9497
### v0.7.0 (2024-09-24)
9598
- Get rid of distutils dependency (@horstle, @emilsvennesson)
9699
- Option to get Widevine from lacros image (@horstle)

script.module.inputstreamhelper/addon.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="script.module.inputstreamhelper" name="InputStream Helper" version="0.7.0" provider-name="emilsvennesson, dagwieers, mediaminister, horstle">
2+
<addon id="script.module.inputstreamhelper" name="InputStream Helper" version="0.8.0" provider-name="emilsvennesson, dagwieers, mediaminister, horstle">
33
<requires>
44
<!--py3 compliant-->
55
<import addon="xbmc.python" version="3.0.0"/>
@@ -25,6 +25,10 @@
2525
<description lang="hr_HR">Jednostavan Kodi modul koji olakšava razvijanje dodataka koji se temelje na InputStream dodatku i reprodukciji DRM zaštićenog sadržaja.</description>
2626
<description lang="ru_RU">Простой модуль для Kodi, который облегчает жизнь разработчикам дополнений, с использованием InputStream дополнений и воспроизведения DRM контента.</description>
2727
<news>
28+
v0.8.0 (2025-09-19)
29+
- Fix Widevine CDM installation on Windows, Linux and Macintosh
30+
- Add support for LG webOS
31+
2832
v0.7.0 (2024-09-24)
2933
- Get rid of distutils dependency
3034
- Option to get Widevine from lacros image

script.module.inputstreamhelper/default.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
''' This is the actual InputStream Helper API script entry point '''
33

4-
from __future__ import absolute_import, division, unicode_literals
54
import sys
65
from lib.inputstreamhelper.api import run
76

script.module.inputstreamhelper/lib/inputstreamhelper/__init__.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
33
"""Implements the main InputStream Helper class"""
44

5-
from __future__ import absolute_import, division, unicode_literals
65
import os
7-
import json
86

97
from . import config
108
from .kodiutils import (addon_version, browsesingle, delete, exists, get_proxies, get_setting, get_setting_bool, get_setting_float, get_setting_int, jsonrpc,
119
kodi_to_ascii, kodi_version, listdir, localize, log, notification, ok_dialog, progress_dialog, select_dialog,
1210
set_setting, set_setting_bool, textviewer, translate_path, yesno_dialog)
1311
from .utils import arch, download_path, http_download, parse_version, remove_tree, system_os, temp_path, unzip, userspace64
1412
from .widevine.arm import dl_extract_widevine_chromeos, extract_widevine_chromeos, install_widevine_arm
15-
from .widevine.arm_lacros import cdm_from_lacros, latest_lacros
13+
from .widevine.arm_lacros import cdm_from_lacros
1614
from .widevine.widevine import (backup_path, has_widevinecdm, ia_cdm_path,
1715
install_cdm_from_backup, latest_widevine_version,
1816
load_widevine_config, missing_widevine_libs, widevine_config_path,
1917
widevine_eula, widevinecdm_path)
20-
from .widevine.repo import cdm_from_repo, choose_widevine_from_repo, latest_widevine_available_from_repo
18+
from .widevine.repo import cdm_from_repo, latest_widevine_available_from_repo
2119
from .unicodes import compat_path
2220

2321
# NOTE: Work around issue caused by platform still using os.popen()
@@ -33,8 +31,7 @@ class InputStreamException(Exception):
3331
def cleanup_decorator(func):
3432
"""Decorator which runs cleanup before and after a function"""
3533

36-
def clean_before_after(self, *args, **kwargs): # pylint: disable=missing-docstring
37-
# pylint only complains about a missing docstring on py2.7?
34+
def clean_before_after(self, *args, **kwargs):
3835
self.cleanup()
3936
result = func(self, *args, **kwargs)
4037
self.cleanup()
@@ -68,10 +65,7 @@ def __init__(self, protocol, drm=None):
6865
# Add proxy support to HTTP requests
6966
proxies = get_proxies()
7067
if proxies:
71-
try: # Python 3
72-
from urllib.request import build_opener, install_opener, ProxyHandler
73-
except ImportError: # Python 2
74-
from urllib2 import build_opener, install_opener, ProxyHandler
68+
from urllib.request import build_opener, install_opener, ProxyHandler
7569
install_opener(build_opener(ProxyHandler(proxies)))
7670

7771
def __repr__(self):
@@ -178,12 +172,9 @@ def _supports_widevine(self):
178172
return True
179173

180174
@staticmethod
181-
def _install_widevine_from_repo(bpath, choose_version=False):
175+
def _install_widevine_from_repo(bpath):
182176
"""Install Widevine CDM from Google's library CDM repository"""
183-
if choose_version:
184-
cdm = choose_widevine_from_repo()
185-
else:
186-
cdm = latest_widevine_available_from_repo()
177+
cdm = latest_widevine_available_from_repo(config.WIDEVINE_OS_MAP[system_os()], config.WIDEVINE_ARCH_MAP_REPO[arch()])
187178

188179
if not cdm:
189180
return cdm
@@ -197,7 +188,8 @@ def _install_widevine_from_repo(bpath, choose_version=False):
197188
if dl_path:
198189
progress = progress_dialog()
199190
progress.create(heading=localize(30043), message=localize(30044)) # Extracting Widevine CDM
200-
unzip(dl_path, os.path.join(bpath, cdm_version, ''))
191+
unzip(dl_path, os.path.join(bpath, cdm_version, ''), file_to_unzip=[config.WIDEVINE_LICENSE_FILE,
192+
config.WIDEVINE_MANIFEST_FILE, config.WIDEVINE_CDM_FILENAME[system_os()]])
201193

202194
return (progress, cdm_version)
203195

@@ -231,7 +223,7 @@ def install_widevine(self, choose_version=False):
231223
return False
232224

233225
if cdm_from_repo():
234-
result = self._install_widevine_from_repo(backup_path(), choose_version=choose_version)
226+
result = self._install_widevine_from_repo(backup_path())
235227
else:
236228
if choose_version:
237229
log(1, "Choosing a version to install is only implemented if the lib is found in googles repo.")
@@ -359,7 +351,7 @@ def _update_widevine(self):
359351

360352
def _check_widevine(self):
361353
"""Checks that all Widevine components are installed and available."""
362-
if system_os() == 'Android': # no checks needed for Android
354+
if system_os() == 'Android' or system_os() == 'webOS': # no checks needed for Android or webOS
363355
return True
364356

365357
if not exists(widevine_config_path()):
@@ -369,7 +361,7 @@ def _check_widevine(self):
369361

370362
if cdm_from_repo(): # check that widevine arch matches system arch
371363
wv_config = load_widevine_config()
372-
if config.WIDEVINE_ARCH_MAP_REPO[arch()] != wv_config['arch']:
364+
if config.WIDEVINE_ARCH_MAP_REPO[arch()] != wv_config['platforms'][0]['arch']:
373365
log(4, 'Widevine/system arch mismatch. Reinstall is required.')
374366
ok_dialog(localize(30001), localize(30031)) # An update of Widevine is required
375367
return self.install_widevine()
@@ -471,6 +463,8 @@ def info_dialog(self):
471463

472464
if system_os() == 'Android':
473465
text += localize(30820) + '\n'
466+
elif system_os() == 'webOS':
467+
text += localize(30826) + '\n'
474468
else:
475469
from time import localtime, strftime
476470
if get_setting_float('last_modified', 0.0):

script.module.inputstreamhelper/lib/inputstreamhelper/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
33
"""This is the actual InputStream Helper API script"""
44

5-
from __future__ import absolute_import, division, unicode_literals
65
from . import Helper
76
from .kodiutils import ADDON, log
87

script.module.inputstreamhelper/lib/inputstreamhelper/config.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
33
"""Configuration variables for inpustreamhelper"""
4-
from __future__ import absolute_import, division, unicode_literals
54

65

76
INPUTSTREAM_PROTOCOLS = {
@@ -20,7 +19,8 @@
2019
'Android': None,
2120
'Linux': 'libwidevinecdm.so',
2221
'Windows': 'widevinecdm.dll',
23-
'Darwin': 'libwidevinecdm.dylib'
22+
'Darwin': 'libwidevinecdm.dylib',
23+
'webOS': None
2424
}
2525

2626
ARCH_MAP = {
@@ -44,12 +44,12 @@
4444

4545
WIDEVINE_ARCH_MAP_REPO = {
4646
'x86_64': 'x64',
47-
'x86': 'ia32',
47+
'x86': 'x86',
4848
'arm64': 'arm64'
4949
}
5050

5151
WIDEVINE_OS_MAP = {
52-
'Linux': 'linux',
52+
'Linux': 'Linux',
5353
'Windows': 'win',
5454
'Darwin': 'mac'
5555
}
@@ -58,21 +58,23 @@
5858
'Android',
5959
'Linux',
6060
'Windows',
61-
'Darwin'
61+
'Darwin',
62+
'webOS'
6263
]
6364

6465
WIDEVINE_MINIMUM_KODI_VERSION = {
6566
'Android': '18.0',
6667
'Windows': '18.0',
6768
'Linux': '18.0',
68-
'Darwin': '18.0'
69+
'Darwin': '18.0',
70+
'webOS': '22.0'
6971
}
7072

7173
WIDEVINE_VERSIONS_URL = 'https://dl.google.com/widevine-cdm/versions.txt'
7274

7375
WIDEVINE_DOWNLOAD_URL = 'https://dl.google.com/widevine-cdm/{version}-{os}-{arch}.zip'
7476

75-
WIDEVINE_LICENSE_FILE = 'LICENSE.txt'
77+
WIDEVINE_LICENSE_FILE = 'LICENSE'
7678

7779
WIDEVINE_MANIFEST_FILE = 'manifest.json'
7880

@@ -83,22 +85,23 @@
8385
# To keep the Chrome OS ARM(64) hardware ID list up to date, the following resources can be used:
8486
# https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices
8587
# https://chromiumdash.appspot.com/serving-builds?deviceCategory=Chrome%20OS
86-
# Last updated: 2023-03-24
88+
# Last updated: 2024-10-13
89+
# current Chrome OS version: 16002.44.0, Widevine version: 4.10.2662.3
8790
CHROMEOS_RECOVERY_ARM_BNAMES = [
91+
'bob', # no longer updated, still latest wv. last: https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15509.81.0_bob_recovery_stable-channel_mp-v2.bin.zip
92+
'elm', # probably 64bit soon. current: https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15886.44.0_elm_recovery_stable-channel_mp-v6.bin.zip
93+
'hana', # probably 64bit soon. current: https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15964.59.0_hana_recovery_stable-channel_mp-v11.bin.zip
94+
'kevin', # no longer updated, still latest wv. last: https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15509.81.0_kevin_recovery_stable-channel_mp-v2.bin.zip
95+
'scarlet', # no longer updated, still latest wv. last: https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_15509.81.0_scarlet_recovery_stable-channel_mp-v8.bin.zip
96+
]
97+
98+
CHROMEOS_RECOVERY_ARM64_BNAMES = [
8899
'asurada',
89-
'bob',
90100
'cherry',
91-
'elm',
92-
'hana',
101+
'corsola',
93102
'jacuzzi',
94-
'kevin',
95103
'kukui',
96-
'scarlet',
97104
'strongbad',
98-
]
99-
100-
CHROMEOS_RECOVERY_ARM64_BNAMES = [
101-
'corsola',
102105
'trogdor',
103106
]
104107

script.module.inputstreamhelper/lib/inputstreamhelper/kodiutils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
33
"""Implements Kodi Helper functions"""
44

5-
from __future__ import absolute_import, division, unicode_literals
65
from contextlib import contextmanager
76
import xbmc
87
import xbmcaddon
@@ -11,7 +10,6 @@
1110
try: # Kodi v19 or newer
1211
from xbmcvfs import translatePath
1312
except ImportError: # Kodi v18 and older
14-
# pylint: disable=ungrouped-imports
1513
from xbmc import translatePath
1614

1715
from .unicodes import from_unicode, to_unicode
@@ -105,7 +103,7 @@ def addon_version(addon_name=None):
105103
return get_addon_info('version', addon)
106104

107105

108-
def browsesingle(type, heading, shares='', mask='', useThumbs=False, treatAsFolder=False, defaultt=None): # pylint: disable=invalid-name,redefined-builtin
106+
def browsesingle(type, heading, shares='', mask='', useThumbs=False, treatAsFolder=False, defaultt=None): # pylint: disable=invalid-name,redefined-builtin,too-many-positional-arguments
109107
"""Show a Kodi browseSingle dialog"""
110108
from xbmcgui import Dialog
111109
if not heading:
@@ -184,6 +182,7 @@ def get_setting_bool(key, default=None):
184182
try:
185183
return ADDON.getSettingBool(key)
186184
except (AttributeError, TypeError): # On Krypton or older, or when not a boolean
185+
log(3, 'get setting bool')
187186
value = get_setting(key, default)
188187
if value not in ('false', 'true'):
189188
return default

script.module.inputstreamhelper/lib/inputstreamhelper/unicodes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
33
"""Implements Unicode Helper functions"""
4-
from __future__ import absolute_import, division, unicode_literals
54

65

76
def to_unicode(text, encoding='utf-8', errors='strict'):

script.module.inputstreamhelper/lib/inputstreamhelper/unsquash.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from .kodiutils import log
2727

2828

29-
class ZstdDecompressor: # pylint: disable=too-few-public-methods
29+
class ZstdDecompressor: # pylint: disable=too-few-public-methods
3030
"""
3131
zstdandard decompressor class
3232
@@ -39,7 +39,7 @@ def __init__(self):
3939
self.zstddecomp.argtypes = (c_void_p, c_size_t, c_void_p, c_size_t)
4040
self.iserror = libzstd.ZSTD_isError
4141

42-
def decompress(self, comp_data, comp_size, outsize=8*2**10):
42+
def decompress(self, comp_data, comp_size, outsize=8 * 2 ** 10):
4343
"""main function, decompresses binary string <src>"""
4444
if len(comp_data) != comp_size:
4545
raise IOError("Decompression failed! Length of compressed data doesn't match given size.")
@@ -168,6 +168,7 @@ class FragmentBlockEntry:
168168
size: int
169169
unused: int # This field has no meaning
170170

171+
171172
class SquashFs:
172173
"""
173174
Main class to handle a squashfs image, find and extract files from it.
@@ -353,7 +354,7 @@ def _get_dentry(self, name):
353354
header = self._directory_header(data)
354355
data = data[12:]
355356

356-
for _ in range(header.count+1):
357+
for _ in range(header.count + 1):
357358
dentry = self._directory_entry(data)
358359
if dentry.name == bname:
359360
log(0, f"found {bname} in dentry {dentry} after dir header {header}")

0 commit comments

Comments
 (0)