Skip to content

Commit

Permalink
API: getTranscodeImagePath: adopt to less lenient PMS API
Browse files Browse the repository at this point in the history
PMS long had ignored extra path components, but some time around
1.23.2.4600 this changed. It still ignores fragments though, so use
those instead.

Fixes issue #597.
  • Loading branch information
bloerwald committed Jun 11, 2021
1 parent ec16bce commit b142706
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions PlexAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,6 @@ def getTranscodeImagePath(key, AuthToken, path, width, height):
path = 'http://127.0.0.1:32400' + path + '/' + key
path = path.encode('utf8')

# This is bogus (note the extra path component) but ATV is stupid when it comes to caching images, it doesn't use querystrings.
# Fortunately PMS is lenient...
transcodePath = '/photo/:/transcode/' +str(width)+'x'+str(height)+ '/' + quote_plus(path)

args = dict()
args['width'] = width
args['height'] = height
Expand All @@ -889,7 +885,8 @@ def getTranscodeImagePath(key, AuthToken, path, width, height):
if not AuthToken=='':
args['X-Plex-Token'] = AuthToken

return transcodePath + '?' + urlencode(args)
# ATV's cache ignores query strings, it does not ignore fragments though, so append the query as fragment as well.
return '/photo/:/transcode' + '?' + urlencode(args) + '#' + urlencode(args)



Expand Down

0 comments on commit b142706

Please sign in to comment.