Plex photos
This commit is contained in:
parent
9a5533337f
commit
6689b265f2
6 changed files with 100 additions and 56 deletions
|
@ -390,6 +390,8 @@
|
||||||
<string id="39042">Replace Plex MUSIC with:</string>
|
<string id="39042">Replace Plex MUSIC with:</string>
|
||||||
<string id="39043">Go a step further and completely replace all original Plex library paths (/volume1/media) with custom SMB paths (smb://NAS/MyStuff)?</string>
|
<string id="39043">Go a step further and completely replace all original Plex library paths (/volume1/media) with custom SMB paths (smb://NAS/MyStuff)?</string>
|
||||||
<string id="39044">Please enter your custom smb paths in the settings under "Sync Options" and then restart Kodi</string>
|
<string id="39044">Please enter your custom smb paths in the settings under "Sync Options" and then restart Kodi</string>
|
||||||
|
<string id="39045">Original Plex PHOTO path to replace:</string>
|
||||||
|
<string id="39046">Replace Plex PHOTO with:</string>
|
||||||
|
|
||||||
<string id="39045">Appearance Tweaks</string>
|
<string id="39045">Appearance Tweaks</string>
|
||||||
<string id="39046">TV Shows</string>
|
<string id="39046">TV Shows</string>
|
||||||
|
|
|
@ -329,6 +329,8 @@
|
||||||
<string id="39042">Plex MUSIK Pfade ersetzen durch:</string>
|
<string id="39042">Plex MUSIK Pfade ersetzen durch:</string>
|
||||||
<string id="39043">Sollen sogar sämtliche Plex Pfade wie /volume1/Hans/medien durch benutzerdefinierte smb Pfade wie smb://NAS/Filme ersetzt werden?</string>
|
<string id="39043">Sollen sogar sämtliche Plex Pfade wie /volume1/Hans/medien durch benutzerdefinierte smb Pfade wie smb://NAS/Filme ersetzt werden?</string>
|
||||||
<string id="39044">Bitte geben Sie Ihre benutzerdefinierten SMB Pfade nun in den Einstellungen unter Sync Optionen ein. Starten Sie dann Kodi neu.</string>
|
<string id="39044">Bitte geben Sie Ihre benutzerdefinierten SMB Pfade nun in den Einstellungen unter Sync Optionen ein. Starten Sie dann Kodi neu.</string>
|
||||||
|
<string id="39045">Ursprünglicher Plex Pfad für PHOTOS:</string>
|
||||||
|
<string id="39046">Plex PHOTO Pfade ersetzen durch:</string>
|
||||||
|
|
||||||
<string id="39045">Erscheinung</string>
|
<string id="39045">Erscheinung</string>
|
||||||
<string id="39046">TV Serien</string>
|
<string id="39046">TV Serien</string>
|
||||||
|
|
|
@ -2289,6 +2289,16 @@ class API():
|
||||||
self.logMsg('Found external subs: %s' % externalsubs)
|
self.logMsg('Found external subs: %s' % externalsubs)
|
||||||
return externalsubs
|
return externalsubs
|
||||||
|
|
||||||
|
def GetFileSize(self):
|
||||||
|
"""
|
||||||
|
Returns the item's filesize in bytes or 0 (int) if unsuccessful
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
ans = int(self.item[0][0].attrib['size'])
|
||||||
|
except:
|
||||||
|
ans = 0
|
||||||
|
return ans
|
||||||
|
|
||||||
def CreateListItemFromPlexItem(self, listItem=None,
|
def CreateListItemFromPlexItem(self, listItem=None,
|
||||||
appendShowTitle=False, appendSxxExx=False):
|
appendShowTitle=False, appendSxxExx=False):
|
||||||
"""
|
"""
|
||||||
|
@ -2301,35 +2311,43 @@ class API():
|
||||||
|
|
||||||
Returns XBMC listitem for this PMS library item
|
Returns XBMC listitem for this PMS library item
|
||||||
"""
|
"""
|
||||||
people = self.getPeople()
|
|
||||||
userdata = self.getUserData()
|
|
||||||
title, sorttitle = self.getTitle()
|
title, sorttitle = self.getTitle()
|
||||||
|
typus = self.getType()
|
||||||
|
|
||||||
if listItem is None:
|
if listItem is None:
|
||||||
listItem = xbmcgui.ListItem(title)
|
listItem = xbmcgui.ListItem(title)
|
||||||
listItem.setProperty('IsPlayable', 'true')
|
listItem.setProperty('IsPlayable', 'true')
|
||||||
|
|
||||||
metadata = {
|
if typus != 'photo':
|
||||||
'genre': self.joinList(self.getGenres()),
|
# Video items, e.g. movies and episodes or clips
|
||||||
'year': self.getYear(),
|
people = self.getPeople()
|
||||||
'rating': self.getAudienceRating(),
|
userdata = self.getUserData()
|
||||||
'playcount': userdata['PlayCount'],
|
metadata = {
|
||||||
'cast': people['Cast'],
|
'genre': self.joinList(self.getGenres()),
|
||||||
'director': self.joinList(people.get('Director')),
|
'year': self.getYear(),
|
||||||
'plot': self.getPlot(),
|
'rating': self.getAudienceRating(),
|
||||||
'sorttitle': sorttitle,
|
'playcount': userdata['PlayCount'],
|
||||||
'duration': userdata['Runtime'],
|
'cast': people['Cast'],
|
||||||
'studio': self.joinList(self.getStudios()),
|
'director': self.joinList(people.get('Director')),
|
||||||
'tagline': self.getTagline(),
|
'plot': self.getPlot(),
|
||||||
'writer': self.joinList(people.get('Writer')),
|
'sorttitle': sorttitle,
|
||||||
'premiered': self.getPremiereDate(),
|
'duration': userdata['Runtime'],
|
||||||
'dateadded': self.getDateCreated(),
|
'studio': self.joinList(self.getStudios()),
|
||||||
'lastplayed': userdata['LastPlayedDate'],
|
'tagline': self.getTagline(),
|
||||||
'mpaa': self.getMpaa(),
|
'writer': self.joinList(people.get('Writer')),
|
||||||
'aired': self.getPremiereDate()
|
'premiered': self.getPremiereDate(),
|
||||||
}
|
'dateadded': self.getDateCreated(),
|
||||||
|
'lastplayed': userdata['LastPlayedDate'],
|
||||||
|
'mpaa': self.getMpaa(),
|
||||||
|
'aired': self.getPremiereDate()
|
||||||
|
}
|
||||||
|
listItem.setProperty('resumetime', str(userdata['Resume']))
|
||||||
|
listItem.setProperty('totaltime', str(userdata['Runtime']))
|
||||||
|
else:
|
||||||
|
# E.g. photo
|
||||||
|
metadata = {'size': self.GetFileSize()}
|
||||||
|
|
||||||
if self.getType() == "episode":
|
if typus == "episode":
|
||||||
# Only for tv shows
|
# Only for tv shows
|
||||||
key, show, season, episode = self.getEpisodeDetails()
|
key, show, season, episode = self.getEpisodeDetails()
|
||||||
season = -1 if season is None else int(season)
|
season = -1 if season is None else int(season)
|
||||||
|
@ -2345,13 +2363,14 @@ class API():
|
||||||
listItem.setIconImage('DefaultTVShows.png')
|
listItem.setIconImage('DefaultTVShows.png')
|
||||||
if appendShowTitle is True:
|
if appendShowTitle is True:
|
||||||
title = show + ' - ' + title
|
title = show + ' - ' + title
|
||||||
elif self.getType() == "movie":
|
elif typus == "movie":
|
||||||
listItem.setIconImage('DefaultMovies.png')
|
listItem.setIconImage('DefaultMovies.png')
|
||||||
|
elif typus == "photo":
|
||||||
|
listItem.setIconImage('DefaultPicture.png')
|
||||||
else:
|
else:
|
||||||
|
# E.g. clips, trailers, ...
|
||||||
listItem.setIconImage('DefaultVideo.png')
|
listItem.setIconImage('DefaultVideo.png')
|
||||||
|
|
||||||
listItem.setProperty('resumetime', str(userdata['Resume']))
|
|
||||||
listItem.setProperty('totaltime', str(userdata['Runtime']))
|
|
||||||
plexId = self.getRatingKey()
|
plexId = self.getRatingKey()
|
||||||
listItem.setProperty('plexid', plexId)
|
listItem.setProperty('plexid', plexId)
|
||||||
with embydb.GetEmbyDB() as emby_db:
|
with embydb.GetEmbyDB() as emby_db:
|
||||||
|
@ -2363,7 +2382,10 @@ class API():
|
||||||
# Expensive operation
|
# Expensive operation
|
||||||
metadata['title'] = title
|
metadata['title'] = title
|
||||||
listItem.setLabel(title)
|
listItem.setLabel(title)
|
||||||
listItem.setInfo('video', infoLabels=metadata)
|
if typus != 'photo':
|
||||||
|
listItem.setInfo('video', infoLabels=metadata)
|
||||||
|
else:
|
||||||
|
listItem.setInfo('pictures', infoLabels=metadata)
|
||||||
return listItem
|
return listItem
|
||||||
|
|
||||||
def AddStreamInfo(self, listItem):
|
def AddStreamInfo(self, listItem):
|
||||||
|
|
|
@ -192,8 +192,16 @@ def doPlayback(itemid, dbid):
|
||||||
if xml in (None, 401):
|
if xml in (None, 401):
|
||||||
return xbmcplugin.setResolvedUrl(
|
return xbmcplugin.setResolvedUrl(
|
||||||
int(sys.argv[1]), False, xbmcgui.ListItem())
|
int(sys.argv[1]), False, xbmcgui.ListItem())
|
||||||
# Everything OK
|
if xml[0].attrib.get('type') == 'photo':
|
||||||
return pbutils.PlaybackUtils(xml).play(itemid, dbid)
|
# Photo
|
||||||
|
API = PlexAPI.API(xml[0])
|
||||||
|
listitem = API.CreateListItemFromPlexItem()
|
||||||
|
API.AddStreamInfo(listitem)
|
||||||
|
pbutils.PlaybackUtils(xml[0]).setArtwork(listitem)
|
||||||
|
return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
|
||||||
|
else:
|
||||||
|
# Video
|
||||||
|
return pbutils.PlaybackUtils(xml).play(itemid, dbid)
|
||||||
|
|
||||||
# utils.logMsg(title, "doPlayback called with itemid=%s, dbid=%s"
|
# utils.logMsg(title, "doPlayback called with itemid=%s, dbid=%s"
|
||||||
# % (itemid, dbid), 1)
|
# % (itemid, dbid), 1)
|
||||||
|
@ -1356,17 +1364,11 @@ def BrowsePlexContent(viewid, mediatype="", folderid=""):
|
||||||
mediatype: mediatype, 'photos'
|
mediatype: mediatype, 'photos'
|
||||||
nodetype: e.g. 'ondeck' (TBD!!)
|
nodetype: e.g. 'ondeck' (TBD!!)
|
||||||
"""
|
"""
|
||||||
utils.logMsg(title, "BrowsePlexContent called with viewid: %s, mediatype: %s, folderid: %s" % (viewid, mediatype, folderid), 1)
|
utils.logMsg(title, "BrowsePlexContent called with viewid: %s, mediatype: "
|
||||||
|
"%s, folderid: %s" % (viewid, mediatype, folderid), 2)
|
||||||
if folderid == 'ondeck':
|
|
||||||
xml = PlexFunctions.GetPlexOnDeck(
|
|
||||||
viewid,
|
|
||||||
containerSize=int(utils.settings('limitindex')))
|
|
||||||
if not xml:
|
|
||||||
utils.logMsg(title, "Cannot get view for section %s" % viewid, -1)
|
|
||||||
return
|
|
||||||
|
|
||||||
if not folderid:
|
if not folderid:
|
||||||
|
# Top-level navigation, so get the content of this section
|
||||||
# Get all sections
|
# Get all sections
|
||||||
xml = PlexFunctions.GetPlexSectionResults(
|
xml = PlexFunctions.GetPlexSectionResults(
|
||||||
viewid,
|
viewid,
|
||||||
|
@ -1375,28 +1377,26 @@ def BrowsePlexContent(viewid, mediatype="", folderid=""):
|
||||||
xml.attrib
|
xml.attrib
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
utils.logMsg(title, "Error download section %s" % viewid, -1)
|
utils.logMsg(title, "Error download section %s" % viewid, -1)
|
||||||
return
|
return xbmcplugin.endOfDirectory(int(sys.argv[1]), False)
|
||||||
else:
|
else:
|
||||||
|
# folderid was passed so we can directly access the folder
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(
|
xml = downloadutils.DownloadUtils().downloadUrl(
|
||||||
"{server}%s" % folderid)
|
"{server}%s" % folderid)
|
||||||
try:
|
try:
|
||||||
xml.attrib
|
xml.attrib
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
utils.logMsg(title, "Error download %s" % folderid, -1)
|
utils.logMsg(title, "Error downloading %s" % folderid, -1)
|
||||||
return
|
return xbmcplugin.endOfDirectory(int(sys.argv[1]), False)
|
||||||
|
|
||||||
|
# Set the folder's name
|
||||||
xbmcplugin.setPluginCategory(int(sys.argv[1]),
|
xbmcplugin.setPluginCategory(int(sys.argv[1]),
|
||||||
xml.attrib.get('librarySectionTitle'))
|
xml.attrib.get('librarySectionTitle'))
|
||||||
|
|
||||||
# set the correct params for the content type
|
# set the correct params for the content type
|
||||||
if mediatype.lower() == "homevideos, tvshows":
|
if mediatype.lower() == "homevideos, tvshows":
|
||||||
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
|
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
|
||||||
itemtype = "Video,Folder,PhotoAlbum"
|
|
||||||
elif mediatype.lower() == "photos":
|
elif mediatype.lower() == "photos":
|
||||||
xbmcplugin.setContent(int(sys.argv[1]), 'files')
|
xbmcplugin.setContent(int(sys.argv[1]), 'files')
|
||||||
itemtype = "Photo,PhotoAlbum,Folder"
|
|
||||||
else:
|
|
||||||
itemtype = ""
|
|
||||||
|
|
||||||
# process the listing
|
# process the listing
|
||||||
for item in xml:
|
for item in xml:
|
||||||
|
@ -1408,20 +1408,32 @@ def BrowsePlexContent(viewid, mediatype="", folderid=""):
|
||||||
li.setProperty('IsFolder', 'true')
|
li.setProperty('IsFolder', 'true')
|
||||||
li.setProperty('IsPlayable', 'false')
|
li.setProperty('IsPlayable', 'false')
|
||||||
path = "%s?id=%s&mode=browseplex&type=%s&folderid=%s" \
|
path = "%s?id=%s&mode=browseplex&type=%s&folderid=%s" \
|
||||||
% (utils.tryDecode(sys.argv[0]),
|
% (sys.argv[0], viewid, mediatype, API.getKey())
|
||||||
utils.tryDecode(viewid),
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
|
||||||
utils.tryDecode(mediatype),
|
url=path,
|
||||||
utils.tryDecode(API.getKey()))
|
listitem=li,
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True)
|
isFolder=True)
|
||||||
else:
|
else:
|
||||||
# playable item, set plugin path and mediastreams
|
if item.attrib.get('type') == 'photo':
|
||||||
path = "%s?id=%s&mode=play" % (sys.argv[0], API.getRatingKey())
|
# pictures
|
||||||
li.setProperty("path", path)
|
if utils.settings('useDirectPaths') == '0':
|
||||||
API.AddStreamInfo(li)
|
# Addon paths
|
||||||
|
path = '%s%s' % (utils.window('pms_server'),
|
||||||
|
item[0][0].attrib['key'])
|
||||||
|
path = API.addPlexCredentialsToUrl(path)
|
||||||
|
else:
|
||||||
|
# Direct paths
|
||||||
|
path = item[0][0].attrib['file']
|
||||||
|
li.setProperty('picturepath', path)
|
||||||
|
else:
|
||||||
|
# videos
|
||||||
|
path = "%s?id=%s&mode=play" % (sys.argv[0], API.getRatingKey())
|
||||||
|
li.setProperty("path", path)
|
||||||
|
API.AddStreamInfo(li)
|
||||||
pbutils.PlaybackUtils(item).setArtwork(li)
|
pbutils.PlaybackUtils(item).setArtwork(li)
|
||||||
xbmcplugin.addDirectoryItem(
|
xbmcplugin.addDirectoryItem(
|
||||||
handle=int(sys.argv[1]),
|
handle=int(sys.argv[1]),
|
||||||
url=li.getProperty("path"),
|
url=path,
|
||||||
listitem=li)
|
listitem=li)
|
||||||
|
|
||||||
if filter == "recent":
|
if filter == "recent":
|
||||||
|
@ -1432,7 +1444,10 @@ def BrowsePlexContent(viewid, mediatype="", folderid=""):
|
||||||
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
|
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
|
||||||
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
|
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(
|
||||||
|
handle=int(sys.argv[1]),
|
||||||
|
cacheToDisc=True if utils.settings('enableTextureCache') == 'true'
|
||||||
|
else False)
|
||||||
|
|
||||||
|
|
||||||
def getOnDeck(viewid, mediatype, tagname, limit):
|
def getOnDeck(viewid, mediatype, tagname, limit):
|
||||||
|
|
|
@ -76,6 +76,8 @@
|
||||||
<setting id="remapSMBtvNew" type="text" label="39040" default="smb://" visible="eq(-4,true)"/> <!-- Replace Plex TV SHOWS with: -->
|
<setting id="remapSMBtvNew" type="text" label="39040" default="smb://" visible="eq(-4,true)"/> <!-- Replace Plex TV SHOWS with: -->
|
||||||
<setting id="remapSMBmusicOrg" type="text" label="39041" default="" visible="eq(-5,true)"/> <!-- Original Plex MUSIC path to replace: -->
|
<setting id="remapSMBmusicOrg" type="text" label="39041" default="" visible="eq(-5,true)"/> <!-- Original Plex MUSIC path to replace: -->
|
||||||
<setting id="remapSMBmusicNew" type="text" label="39042" default="smb://" visible="eq(-6,true)"/> <!-- Replace Plex MUSIC with: -->
|
<setting id="remapSMBmusicNew" type="text" label="39042" default="smb://" visible="eq(-6,true)"/> <!-- Replace Plex MUSIC with: -->
|
||||||
|
<setting id="remapSMBphotoOrg" type="text" label="39045" default="" visible="eq(-7,true)"/> <!-- Original Plex MUSIC path to replace: -->
|
||||||
|
<setting id="remapSMBphotoNew" type="text" label="39046" default="smb://" visible="eq(-8,true)"/> <!-- Replace Plex MUSIC with: -->
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="30516"><!-- Playback -->
|
<category label="30516"><!-- Playback -->
|
||||||
|
|
|
@ -96,7 +96,8 @@ class Service():
|
||||||
"plex_authenticated", "PlexUserImage", "useDirectPaths",
|
"plex_authenticated", "PlexUserImage", "useDirectPaths",
|
||||||
"replaceSMB", "remapSMB", "remapSMBmovieOrg", "remapSMBtvOrg",
|
"replaceSMB", "remapSMB", "remapSMBmovieOrg", "remapSMBtvOrg",
|
||||||
"remapSMBmusicOrg", "remapSMBmovieNew", "remapSMBtvNew",
|
"remapSMBmusicOrg", "remapSMBmovieNew", "remapSMBtvNew",
|
||||||
"remapSMBmusicNew", "suspend_LibraryThread", "plex_terminateNow",
|
"remapSMBmusicNew", "remapSMBphotoOrg", "remapSMBphotoNew",
|
||||||
|
"suspend_LibraryThread", "plex_terminateNow",
|
||||||
"kodiplextimeoffset", "countError", "countUnauthorized"
|
"kodiplextimeoffset", "countError", "countUnauthorized"
|
||||||
]
|
]
|
||||||
for prop in properties:
|
for prop in properties:
|
||||||
|
|
Loading…
Reference in a new issue