MCPcopy
hub / github.com/iBaa/PlexConnect / ATTRIB_IMAGEURL

Method ATTRIB_IMAGEURL

XMLConverter.py:1030–1083  ·  view source on GitHub ↗
(self, src, srcXML, param)

Source from the content-addressed store, hash-verified

1028 return res
1029
1030 def ATTRIB_IMAGEURL(self, src, srcXML, param):
1031 key, leftover, dfltd = self.getKey(src, srcXML, param)
1032 width, leftover = self.getParam(src, leftover)
1033 height, leftover = self.getParam(src, leftover)
1034 if height=='':
1035 height = width
1036
1037 PMS_uuid = self.PMS_uuid
1038 PMS_baseURL = self.PMS_baseURL
1039 cmd_start = key.find('PMS(')
1040 cmd_end = key.find(')', cmd_start)
1041 if cmd_start>-1 and cmd_end>-1 and cmd_end>cmd_start:
1042 PMS_address = key[cmd_start+4:cmd_end]
1043 PMS_uuid = PlexAPI.getPMSFromAddress(self.ATV_udid, PMS_address)
1044 PMS_baseURL = PlexAPI.getPMSProperty(self.ATV_udid, PMS_uuid, 'baseURL')
1045 key = key[cmd_end+1:]
1046
1047 AuthToken = PlexAPI.getPMSProperty(self.ATV_udid, PMS_uuid, 'accesstoken')
1048
1049 # transcoder action
1050 transcoderAction = g_ATVSettings.getSetting(self.ATV_udid, 'phototranscoderaction')
1051
1052 # image orientation
1053 orientation, leftover, dfltd = self.getKey(src, srcXML, 'Media/Part/orientation')
1054 normalOrientation = (not orientation) or orientation=='1'
1055
1056 # aTV native filetypes
1057 parts = key.rsplit('.',1)
1058 photoATVNative = parts[-1].lower() in ['jpg','jpeg','tif','tiff','gif','png']
1059 dprint(__name__, 2, "photo: ATVNative - {0}", photoATVNative)
1060
1061 if width=='' and \
1062 transcoderAction=='Auto' and \
1063 normalOrientation and \
1064 photoATVNative:
1065 # direct play
1066 res = PlexAPI.getDirectImagePath(key, AuthToken)
1067 else:
1068 if width=='':
1069 width = 1920 # max for HDTV. Relate to aTV version? Increase for KenBurns effect?
1070 if height=='':
1071 height = 1080 # as above
1072 # request transcoding
1073 res = PlexAPI.getTranscodeImagePath(key, AuthToken, self.path[srcXML], width, height)
1074
1075 if res.startswith('/'): # internal full path.
1076 res = PMS_baseURL + res
1077 elif res.startswith('http://') or key.startswith('https://'): # external address
1078 pass
1079 else: # internal path, add-on
1080 res = PMS_baseURL + self.path[srcXML] + '/' + res
1081
1082 dprint(__name__, 1, 'ImageURL: {0}', res)
1083 return res
1084
1085 def ATTRIB_MUSICURL(self, src, srcXML, param):
1086 Track, leftover = self.getElement(src, srcXML, param)

Callers

nothing calls this directly

Calls 4

dprintFunction · 0.85
getKeyMethod · 0.80
getParamMethod · 0.80
getSettingMethod · 0.45

Tested by

no test coverage detected