Skip to content

Commit 84e6c36

Browse files
authored
Fix issue with new install_from option, where no config.json is created and thus the version couldn't be determined reliably. (#515)
1 parent fcd510f commit 84e6c36

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/inputstreamhelper/widevine/arm.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def dl_extract_widevine(url, backup_path, arm_device=None):
113113
else:
114114
downloaded = http_download(url, message=localize(30022))
115115
image_version = os.path.basename(url).split('_')[1]
116+
# minimal info for config.json, "version" is definitely needed e.g. in load_widevine_config:
117+
arm_device = {"file": os.path.basename(url), "url": url, "version": image_version}
116118

117119
if downloaded:
118120
image_path = store('download_path')
@@ -121,10 +123,9 @@ def dl_extract_widevine(url, backup_path, arm_device=None):
121123
if not progress:
122124
return False
123125

124-
if arm_device:
125-
config_file = os.path.join(backup_path, image_version, 'config.json')
126-
with open_file(config_file, 'w') as conf_file:
127-
conf_file.write(json.dumps(arm_device))
126+
config_file = os.path.join(backup_path, image_version, 'config.json')
127+
with open_file(config_file, 'w') as conf_file:
128+
conf_file.write(json.dumps(arm_device))
128129

129130
return (progress, image_version)
130131

lib/inputstreamhelper/widevine/widevine.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ def remove_old_backups(bpath):
192192
if len(versions) < 2:
193193
return
194194

195-
installed_version = load_widevine_config()['version']
195+
try:
196+
installed_version = load_widevine_config()['version']
197+
except TypeError:
198+
log(2, "could not determine installed version. Aborting cleanup of old versions.")
199+
return
196200

197201
while len(versions) > max_backups + 1:
198202
remove_version = str(versions[1] if versions[0] == parse_version(installed_version) else versions[0])

0 commit comments

Comments
 (0)