mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Merge pull request #803 from sy6sy2/fix-tvos
Use xbmcvfs functions to read and write filesystem files
This commit is contained in:
commit
8869ace79a
1 changed files with 8 additions and 3 deletions
|
@ -117,13 +117,18 @@ def verify_kodi_defaults():
|
||||||
|
|
||||||
if xbmcvfs.exists(file_name):
|
if xbmcvfs.exists(file_name):
|
||||||
try:
|
try:
|
||||||
tree = etree.parse(file_name)
|
with xbmcvfs.File(file_name) as f:
|
||||||
|
b = f.read()
|
||||||
|
tree = etree.ElementTree(etree.fromstring(b))
|
||||||
except etree.ParseError:
|
except etree.ParseError:
|
||||||
LOG.error("Unable to parse `{}`".format(file_name))
|
LOG.error("Unable to parse `{}`".format(file_name))
|
||||||
LOG.exception("We ensured the file was OK above, something is wrong!")
|
LOG.exception("We ensured the file was OK above, something is wrong!")
|
||||||
|
tree = None
|
||||||
|
|
||||||
tree.getroot().set('order', str(17 + index))
|
if tree is not None:
|
||||||
tree.write(file_name)
|
tree.getroot().set('order', str(17 + index))
|
||||||
|
with xbmcvfs.File(file_name, 'w') as f:
|
||||||
|
f.write(etree.tostring(tree.getroot()))
|
||||||
|
|
||||||
playlist_path = translate_path("special://profile/playlists/video")
|
playlist_path = translate_path("special://profile/playlists/video")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue