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 Dec 28, 2023
1 parent 1233e29 commit ec76288
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 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)
f = xbmcvfs.File(file_name)
b = f.read()
f.close()
tree = etree.ElementTree(etree.fromstring(b))

Check warning on line 123 in jellyfin_kodi/helper/xmls.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/helper/xmls.py#L120-L123

Added lines #L120 - L123 were not covered by tests
except etree.ParseError:
LOG.error("Unable to parse `{}`".format(file_name))
LOG.exception("We ensured the file was OK above, something is wrong!")

tree.getroot().set('order', str(17 + index))
tree.write(file_name)
f = xbmcvfs.File(file_name)
f.write(etree.tostring(tree.getroot()))
f.close()

Check warning on line 131 in jellyfin_kodi/helper/xmls.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/helper/xmls.py#L129-L131

Added lines #L129 - L131 were not covered by tests

playlist_path = translate_path("special://profile/playlists/video")

Expand Down

0 comments on commit ec76288

Please sign in to comment.