Skip to content

Commit bda852e

Browse files
authored
Support undetected version (#216)
For some reason unclear yet, I ended up with a widevinecdm.so that had size 0, so obviosuly it didn't match the regexp and match would be None. Resulting in: File "/storage/.kodi/addons/script.module.inputstreamhelper/lib/inputstreamhelper/__init__.py", line 244, in _get_lib_version return match.group(0).lstrip('0') AttributeError: 'NoneType' object has no attribute 'group'
1 parent 28ece36 commit bda852e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/inputstreamhelper/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,14 @@ def _inputstream_version(self):
235235

236236
@staticmethod
237237
def _get_lib_version(path):
238-
if path:
239-
import re
240-
with open(path, 'rb') as library:
241-
match = re.search(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', str(library.read()))
242-
return match.group(0).lstrip('0')
243-
return '(Not found)'
238+
if not path:
239+
return '(Not found)'
240+
import re
241+
with open(path, 'rb') as library:
242+
match = re.search(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', str(library.read()))
243+
if not match:
244+
return '(Undetected)'
245+
return match.group(0).lstrip('0')
244246

245247
def _chromeos_offset(self, bin_path):
246248
"""Calculate the Chrome OS losetup start offset using fdisk/parted."""

0 commit comments

Comments
 (0)