Add Plex ID to photo ListItems
This commit is contained in:
parent
4de4959c53
commit
2a5cf9d798
2 changed files with 13 additions and 15 deletions
|
@ -1210,7 +1210,8 @@ class API():
|
|||
|
||||
def get_picture_path(self):
|
||||
"""
|
||||
Returns the item's picture path (transcode, if necessary) as string
|
||||
Returns the item's picture path (transcode, if necessary) as string.
|
||||
Will always use addon paths, never direct paths
|
||||
"""
|
||||
extension = self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower()
|
||||
if (window('plex_force_transcode_pix') == 'true' or
|
||||
|
@ -1224,19 +1225,12 @@ class API():
|
|||
1920,
|
||||
1080)
|
||||
else:
|
||||
# Don't transcode
|
||||
if window('useDirectPaths') == 'true':
|
||||
# Addon Mode. Just give the path of the file to Kodi
|
||||
path = self.addPlexCredentialsToUrl(
|
||||
'%s%s' % (window('pms_server'),
|
||||
self.item[0][0].attrib['key']))
|
||||
else:
|
||||
# Native direct paths
|
||||
path = self.validatePlayurl(
|
||||
self.getFilePath(forceFirstMediaStream=True),
|
||||
'photo')
|
||||
path = tryEncode(path)
|
||||
return path
|
||||
# Attach Plex id to url to let it be picked up by our playqueue agent
|
||||
# later
|
||||
return tryEncode('%s&plex_id=%s' % (path, self.getRatingKey()))
|
||||
|
||||
def getTVShowPath(self):
|
||||
"""
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import logging
|
||||
from urllib import quote
|
||||
from urlparse import parse_qsl, urlsplit
|
||||
|
||||
import plexdb_functions as plexdb
|
||||
from downloadutils import DownloadUtils as DU
|
||||
from utils import JSONRPC, tryEncode, tryDecode
|
||||
from utils import JSONRPC, tryEncode
|
||||
from PlexAPI import API
|
||||
|
||||
###############################################################################
|
||||
|
@ -111,6 +112,9 @@ def playlist_item_from_kodi(kodi_item):
|
|||
except TypeError:
|
||||
pass
|
||||
item.file = kodi_item.get('file')
|
||||
if item.file is not None and item.plex_id is None:
|
||||
item.plex_id = dict(
|
||||
parse_qsl(urlsplit(item.file).query)).get('plex_id')
|
||||
item.kodi_type = kodi_item.get('type')
|
||||
if item.plex_id is None:
|
||||
item.uri = 'library://whatever/item/%s' % quote(item.file, safe='')
|
||||
|
|
Loading…
Reference in a new issue