Fix Kodi playlists being empty

- Fixes #305
This commit is contained in:
tomkat83 2017-06-06 20:12:16 +02:00
parent b3466e9136
commit 73289d00f0

View file

@ -865,6 +865,7 @@ def passwordsXML():
# time=5000, # time=5000,
# sound=False) # sound=False)
def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False): def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
""" """
Feed with tagname as unicode Feed with tagname as unicode
@ -898,8 +899,8 @@ def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
'show': 'tvshows' 'show': 'tvshows'
} }
log.info("Writing playlist file to: %s" % xsppath) log.info("Writing playlist file to: %s" % xsppath)
with open(xsppath, 'wb'): with open(xsppath, 'wb') as f:
tryEncode( f.write(tryEncode(
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\n' '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\n'
'<smartplaylist type="%s">\n\t' '<smartplaylist type="%s">\n\t'
'<name>Plex %s</name>\n\t' '<name>Plex %s</name>\n\t'
@ -908,9 +909,10 @@ def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
'<value>%s</value>\n\t' '<value>%s</value>\n\t'
'</rule>\n' '</rule>\n'
'</smartplaylist>\n' '</smartplaylist>\n'
% (itemtypes.get(mediatype, mediatype), plname, tagname)) % (itemtypes.get(mediatype, mediatype), plname, tagname)))
log.info("Successfully added playlist: %s" % tagname) log.info("Successfully added playlist: %s" % tagname)
def deletePlaylists(): def deletePlaylists():
# Clean up the playlists # Clean up the playlists
path = tryDecode(xbmc.translatePath("special://profile/playlists/video/")) path = tryDecode(xbmc.translatePath("special://profile/playlists/video/"))