Skip to content

Commit

Permalink
Use xbmcvfs functions to read and write filesystem files (fix Jellyfi…
Browse files Browse the repository at this point in the history
…n addon on tvOS)
  • Loading branch information
sy6sy2 committed Feb 8, 2024
1 parent 1233e29 commit dad390c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jellyfin_kodi/helper/xmls.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,18 @@ def verify_kodi_defaults():

if xbmcvfs.exists(file_name):
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:
LOG.error("Unable to parse `{}`".format(file_name))
LOG.exception("We ensured the file was OK above, something is wrong!")
tree = None

tree.getroot().set('order', str(17 + index))
tree.write(file_name)
if tree is not None:
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")

Expand Down

0 comments on commit dad390c

Please sign in to comment.