Skip to content

Commit

Permalink
Merge pull request #803 from sy6sy2/fix-tvos
Browse files Browse the repository at this point in the history
Use xbmcvfs functions to read and write filesystem files
  • Loading branch information
mcarlton00 authored Mar 9, 2024
2 parents 42d1c53 + dad390c commit 8869ace
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 8869ace

Please sign in to comment.