From a457d96a601e7c9d3bc0d33acb2a16531d15caf6 Mon Sep 17 00:00:00 2001 From: Memesa Date: Tue, 20 Dec 2016 21:05:01 +0100 Subject: [PATCH] Plex RAW photos/picture support This feature was requested. I got it implemented by passing the path of the image, if it is not a normal image file, through the getTranscodeImagePath function in the PlexAPI class. This requests Plex to transcode the file before sending it to Kodi. Slight disadvantage is the maximum resolution of 1920x1080, but I doubt that will impact many people. --- resources/lib/PlexAPI.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index b63bf71a..2501cc53 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2360,7 +2360,14 @@ class API(): listItem.setProperty('IsPlayable', 'true') if settings('useDirectPaths') == '0': # Addon paths - path = self.addPlexCredentialsToUrl( + if not self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower() in ('.bmp', '.jpg', '.jpeg', '.gif', '.png', '.tiff', '.mng', '.ico', '.pcx', '.tga'): + # Check if Kodi supports the file, if not transcode it by Plex + # extensions from: http://kodi.wiki/view/Features_and_supported_codecs#Format_support (RAW image formats, BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX and Targa/TGA) + path = str(self.server) + str(PlexAPI().getTranscodeImagePath(self.item[0][0].attrib.get('key'), window('pms_token'), "%s%s" % (self.server, self.item[0][0].attrib.get('key')), 1920, 1080)) + # max width/height supported by plex image transcoder is 1920x1080 + else: + # Just give the path of the file to Kodi + path = self.addPlexCredentialsToUrl( '%s%s' % (window('pms_server'), self.item[0][0].attrib['key'])) else: