Add PMS collection tags to movies

This commit is contained in:
tomkat83 2016-03-01 16:18:12 +01:00
parent 9465939397
commit e8f1382916
3 changed files with 23 additions and 16 deletions

View file

@ -1519,6 +1519,16 @@ class API():
'UserRating': userrating 'UserRating': userrating
} }
def getCollections(self):
"""
Returns a list of PMS collection tags
"""
collections = []
for child in self.item:
if child.tag == 'Collection':
collections.append(child.attrib['tag'])
return collections
def getPeople(self): def getPeople(self):
""" """
Returns a dict of lists of people found. Returns a dict of lists of people found.
@ -1574,14 +1584,10 @@ class API():
name_id = child.attrib['id'] name_id = child.attrib['id']
Type = child.tag Type = child.tag
Type = people_of_interest[Type] Type = people_of_interest[Type]
try:
url = child.attrib['thumb'] url = child.attrib.get('thumb')
except KeyError: Role = child.attrib.get('role')
url = None
try:
Role = child.attrib['role']
except KeyError:
Role = None
people.append({ people.append({
'Name': name, 'Name': name,
'Type': Type, 'Type': Type,

View file

@ -31,7 +31,7 @@ def ConvertPlexToKodiTime(plexTime):
def GetItemClassFromType(itemType): def GetItemClassFromType(itemType):
classes = { classes = {
'movie': 'Movies', 'movie': 'Movies',
'episodes': 'TVShows', 'season': 'TVShows',
'episode': 'TVShows', 'episode': 'TVShows',
'show': 'TVShows', 'show': 'TVShows',
'artist': 'Music', 'artist': 'Music',

View file

@ -325,9 +325,9 @@ class Movies(Items):
update_item = False update_item = False
self.logMsg("movieid: %s missing from Kodi, repairing the entry." % movieid, 1) self.logMsg("movieid: %s missing from Kodi, repairing the entry." % movieid, 1)
if not viewtag or not viewid: # if not viewtag or not viewid:
# Get view tag from emby # # Get view tag from emby
viewtag, viewid, mediatype = self.emby.getView_embyId(itemid) # viewtag, viewid, mediatype = self.emby.getView_embyId(itemid)
# fileId information # fileId information
checksum = API.getChecksum() checksum = API.getChecksum()
@ -349,6 +349,7 @@ class Movies(Items):
shortplot = None shortplot = None
tagline = API.getTagline() tagline = API.getTagline()
votecount = None votecount = None
collections = API.getCollections()
rating = API.getAudienceRating() rating = API.getAudienceRating()
year = API.getYear() year = API.getYear()
@ -491,11 +492,11 @@ class Movies(Items):
kodi_db.addStreams(fileid, streams, runtime) kodi_db.addStreams(fileid, streams, runtime)
# Process studios # Process studios
kodi_db.addStudios(movieid, studios, "movie") kodi_db.addStudios(movieid, studios, "movie")
# Process tags: view, emby tags # Process tags: view, Plex collection tags
tags = [viewtag] tags = [viewtag]
# tags.extend(item['Tags']) tags.extend(collections)
# if userdata['Favorite']: if userdata['Favorite']:
# tags.append("Favorite movies") tags.append("Favorite movies")
kodi_db.addTags(movieid, tags, "movie") kodi_db.addTags(movieid, tags, "movie")
# Process playstates # Process playstates
kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed)