diff --git a/lib/inputstreamhelper/__init__.py b/lib/inputstreamhelper/__init__.py index a2ab6bf2..fec532ae 100644 --- a/lib/inputstreamhelper/__init__.py +++ b/lib/inputstreamhelper/__init__.py @@ -185,7 +185,7 @@ def _install_widevine_x86(bpath): if downloaded: progress = progress_dialog() progress.create(heading=localize(30043), message=localize(30044)) # Extracting Widevine CDM - unzip(store('download_path'), os.path.join(bpath, cdm_version)) + unzip(store('download_path'), os.path.join(bpath, cdm_version, '')) return (progress, cdm_version) diff --git a/lib/inputstreamhelper/kodiutils.py b/lib/inputstreamhelper/kodiutils.py index 31284514..aa107c47 100644 --- a/lib/inputstreamhelper/kodiutils.py +++ b/lib/inputstreamhelper/kodiutils.py @@ -358,6 +358,7 @@ def delete(path): def exists(path): """Whether the path exists (using xbmcvfs)""" + # File or folder (folder must end with slash or backslash) from xbmcvfs import exists as vfsexists return vfsexists(from_unicode(path)) diff --git a/lib/inputstreamhelper/utils.py b/lib/inputstreamhelper/utils.py index 729ee41e..aca30249 100644 --- a/lib/inputstreamhelper/utils.py +++ b/lib/inputstreamhelper/utils.py @@ -21,8 +21,8 @@ def temp_path(): - """Return temporary path, usually ~/.kodi/userdata/addon_data/script.module.inputstreamhelper/temp""" - tmp_path = translate_path(os.path.join(get_setting('temp_path', 'special://masterprofile/addon_data/script.module.inputstreamhelper'), 'temp')) + """Return temporary path, usually ~/.kodi/userdata/addon_data/script.module.inputstreamhelper/temp/""" + tmp_path = translate_path(os.path.join(get_setting('temp_path', 'special://masterprofile/addon_data/script.module.inputstreamhelper'), 'temp', '')) if not exists(tmp_path): mkdirs(tmp_path) diff --git a/lib/inputstreamhelper/widevine/arm.py b/lib/inputstreamhelper/widevine/arm.py index db54261e..a780255a 100644 --- a/lib/inputstreamhelper/widevine/arm.py +++ b/lib/inputstreamhelper/widevine/arm.py @@ -14,10 +14,10 @@ from .arm_chromeos import ChromeOSImage -def mnt_path(): - """Return mount path, usually ~/.kodi/userdata/addon_data/script.module.inputstreamhelper/temp/mnt""" - mount_path = os.path.join(temp_path(), 'mnt') - if not exists(mount_path): +def mnt_path(make=True): + """Return mount path, usually ~/.kodi/userdata/addon_data/script.module.inputstreamhelper/temp/mnt/""" + mount_path = os.path.join(temp_path(), 'mnt', '') + if make and not exists(mount_path): mkdir(mount_path) return mount_path @@ -294,7 +294,7 @@ def extract_widevine_from_img(backup_path): def unmount(): """Unmount mountpoint if mounted""" - while os.path.ismount(compat_path(mnt_path())): + while os.path.ismount(compat_path(mnt_path(make=False))): log(0, 'Unmount {mountpoint}', mountpoint=mnt_path()) umount_output = run_cmd(['umount', compat_path(mnt_path())], sudo=True) if not umount_output['success']: diff --git a/lib/inputstreamhelper/widevine/arm_chromeos.py b/lib/inputstreamhelper/widevine/arm_chromeos.py index 65b34ef2..9b0f7f60 100644 --- a/lib/inputstreamhelper/widevine/arm_chromeos.py +++ b/lib/inputstreamhelper/widevine/arm_chromeos.py @@ -303,8 +303,9 @@ def write_file(self, inode_dict, filepath): block_ids_sorted.sort() block_dict = self.read_file(block_ids_sorted) - if not exists(os.path.dirname(filepath)): - mkdirs(os.path.dirname(filepath)) + write_dir = os.path.join(os.path.dirname(filepath), '') + if not exists(write_dir): + mkdirs(write_dir) with open(compat_path(filepath), 'wb') as opened_file: for block_id in block_ids: diff --git a/lib/inputstreamhelper/widevine/widevine.py b/lib/inputstreamhelper/widevine/widevine.py index 7fd018d8..8f61bf5d 100644 --- a/lib/inputstreamhelper/widevine/widevine.py +++ b/lib/inputstreamhelper/widevine/widevine.py @@ -53,7 +53,7 @@ def widevine_eula(): def backup_path(): """Return the path to the cdm backups""" - path = os.path.join(addon_profile(), 'backup') + path = os.path.join(addon_profile(), 'backup', '') if not exists(path): mkdirs(path) return path @@ -111,7 +111,7 @@ def ia_cdm_path(): except RuntimeError: return None - cdm_path = translate_path(to_unicode(addon.getSetting('DECRYPTERPATH'))) + cdm_path = translate_path(os.path.join(to_unicode(addon.getSetting('DECRYPTERPATH')), '')) if not exists(cdm_path): mkdirs(cdm_path)