Video nodes finally working

This commit is contained in:
tomkat83 2016-01-11 15:56:56 +01:00
parent 21fed2dc63
commit 3b2176574a
2 changed files with 22 additions and 23 deletions

View file

@ -310,11 +310,10 @@ class Movies(Items):
kodicursor.execute("select coalesce(max(idMovie),0) from movie")
movieid = kodicursor.fetchone()[0] + 1
# if not viewtag or not viewid:
# # Get view tag from emby
# viewtag, viewid, mediatype = self.emby.getView_embyId(itemid)
# self.logMsg("View tag found: %s" % viewtag, 2)
if not viewtag or not viewid:
# Get view tag from emby
viewtag, viewid, mediatype = self.emby.getView_embyId(itemid)
self.logMsg("View tag found: %s" % viewtag, 2)
# fileId information
checksum = API.getChecksum()
@ -472,13 +471,13 @@ class Movies(Items):
# Process studios
kodi_db.addStudios(movieid, studios, "movie")
# Process tags: view, emby tags
# tags = [viewtag]
tags = [viewtag]
# tags.extend(item['Tags'])
# if userdata['Favorite']:
# tags.append("Favorite movies")
# kodi_db.addTags(movieid, tags, "movie")
# tags.append("Favorite movies")
kodi_db.addTags(movieid, tags, "movie")
# Process playstates
# resume = API.adjustResume(userdata['Resume'])
resume = API.adjustResume(userdata['Resume'])
kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed)
def updateUserdata(self, item):
@ -1191,10 +1190,7 @@ class TVShows(Items):
update_item = False
self.logMsg("showid: %s not found." % itemid, 2)
# if viewtag is None or viewid is None:
# # Get view tag from emby
# viewtag, viewid, mediatype = emby.getView_embyId(itemid)
# self.logMsg("View tag found: %s" % viewtag, 2)
self.logMsg("View tag found: %s" % viewtag, 2)
# fileId information
checksum = API.getChecksum()
@ -1326,12 +1322,8 @@ class TVShows(Items):
# Process studios
kodi_db.addStudios(showid, studios, "tvshow")
# Process tags: view, emby tags
# tags = [viewtag]
# tags.extend(item['Tags'])
# if userdata['Favorite']:
# tags.append("Favorite tvshows")
# kodi_db.addTags(showid, tags, "tvshow")
# Process seasons
tags = [viewtag]
kodi_db.addTags(showid, tags, "tvshow")
def refreshSeasonEntry(self, item, showid):
API = PlexAPI.API(item)

View file

@ -56,6 +56,13 @@ class VideoNodes(object):
kodiversion = self.kodiversion
# mediatype conversion
# LEFT: Plex wording, right: Kodi wording
mediaTypeConversion = {
'movie': 'movies',
'show': 'tvshows'
}
mediatype = mediaTypeConversion[mediatype]
if mediatype == "homevideos":
# Treat homevideos as movies
mediatype = "movies"
@ -68,7 +75,7 @@ class VideoNodes(object):
path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
nodepath = xbmc.translatePath(
"special://profile/library/video/plex-%s/" % dirname).decode('utf-8')
"special://profile/library/video/plex%s/" % dirname).decode('utf-8')
# Verify the video directory
if not xbmcvfs.exists(path):
@ -93,7 +100,7 @@ class VideoNodes(object):
# Create index entry
nodeXML = "%sindex.xml" % nodepath
# Set windows property
path = "library://video/plex-%s/" % dirname
path = "library://video/plex%s/" % dirname
for i in range(1, indexnumber):
# Verify to make sure we don't create duplicates
if utils.window('Emby.nodes.%s.index' % i) == path:
@ -124,7 +131,7 @@ class VideoNodes(object):
}
mediatypes = {
# label according to nodetype per mediatype
'movie': {
'movies': {
'1': tagname,
'2': 30174,
'4': 30177,
@ -134,7 +141,7 @@ class VideoNodes(object):
'10': 30229,
'11': 30230},
'show': {
'tvshows': {
'1': tagname,
'2': 30170,
'3': 30175,