From 7b3aae2d83940ad1a6cfa31fc56a90607bf938e9 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 26 Dec 2015 03:09:47 -0600 Subject: [PATCH] Fix fanart --- resources/lib/entrypoint.py | 5 ++++- resources/lib/utils.py | 30 +++++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 8cf86dc3..489cf8bc 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -799,7 +799,10 @@ def getExtraFanArt(): if any([x in itemPath for x in ['tvshows', 'musicvideos', 'movies']]): params = urlparse.parse_qs(itemPath) - embyId = params['id'][0] + try: + embyId = params['id'][0] + except KeyError: + embyId = itemPath.split("/")[-2] utils.logMsg("EMBY", "Requesting extrafanart for Id: %s" % embyId, 1) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 83e73e1d..0f3c0466 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -458,6 +458,7 @@ def playlistXSP(mediatype, tagname, viewtype="", delete=False): # Create the playlist directory if not xbmcvfs.exists(path): + logMsg("EMBY", "Creating directory: %s" % path, 1) xbmcvfs.mkdirs(path) # Only add the playlist if it doesn't already exists @@ -473,15 +474,22 @@ def playlistXSP(mediatype, tagname, viewtype="", delete=False): itemtypes = { 'homevideos': "movies" } - f = open(xsppath, 'w') - f.write( - '\n' - '\n\t' - 'Emby %s\n\t' - 'all\n\t' - '\n\t\t' - '%s\n\t' - '' - % (itemtypes.get(mediatype, mediatype), plname, tagname)) - f.close() + logMsg("EMBY", "Writing playlist file to: %s" % xsppath, 1) + try: + f = open(xsppath, 'w') + except: + logMsg("EMBY", "Failed to create playlist: %s" % xsppath, 1) + return + else: + f.write( + '\n' + '\n\t' + 'Emby %s\n\t' + 'all\n\t' + '\n\t\t' + '%s\n\t' + '' + '' + % (itemtypes.get(mediatype, mediatype), plname, tagname)) + f.close() logMsg("EMBY", "Successfully added playlist: %s" % tagname) \ No newline at end of file