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
}
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):
"""
Returns a dict of lists of people found.
@ -1574,14 +1584,10 @@ class API():
name_id = child.attrib['id']
Type = child.tag
Type = people_of_interest[Type]
try:
url = child.attrib['thumb']
except KeyError:
url = None
try:
Role = child.attrib['role']
except KeyError:
Role = None
url = child.attrib.get('thumb')
Role = child.attrib.get('role')
people.append({
'Name': name,
'Type': Type,

View file

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

View file

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