Fixed video nodes

This commit is contained in:
tomkat83 2016-03-03 09:04:15 +01:00
parent c8004d3dbf
commit ccdaaf5b4e
3 changed files with 45 additions and 36 deletions

View file

@ -413,7 +413,7 @@ class LibrarySync(Thread):
nodes = self.nodes[mediatype] nodes = self.nodes[mediatype]
# Prevent duplicate for playlists of the same type # Prevent duplicate for playlists of the same type
playlists = self.playlists[mediatype] playlists = self.playlists[mediatype]
sorted_views = self.sorted_views[mediatype] sorted_views = self.sorted_views
folderid = folder['key'] folderid = folder['key']
foldername = folder['title'] foldername = folder['title']
@ -456,7 +456,6 @@ class LibrarySync(Thread):
# Remove views that are still valid to delete rest later # Remove views that are still valid to delete rest later
try: try:
# View is still valid
self.old_views.remove(folderid) self.old_views.remove(folderid)
except ValueError: except ValueError:
# View was just created, nothing to remove # View was just created, nothing to remove
@ -550,9 +549,6 @@ class LibrarySync(Thread):
self.logMsg("Error download PMS views, abort maintainViews", -1) self.logMsg("Error download PMS views, abort maintainViews", -1)
return False return False
# total nodes for window properties
vnodes.clearProperties()
totalnodes = 0
# For whatever freaking reason, .copy() or dict() does NOT work?!?!?! # For whatever freaking reason, .copy() or dict() does NOT work?!?!?!
self.nodes = { self.nodes = {
'movie': [], 'movie': [],
@ -564,16 +560,17 @@ class LibrarySync(Thread):
'show': [], 'show': [],
'artist': [] 'artist': []
} }
self.sorted_views = { self.sorted_views = []
'movie': [],
'show': [],
'artist': []
}
for view in sections: for view in sections:
itemType = view.attrib['type'] itemType = view.attrib['type']
if itemType in ('movie', 'show'): # and NOT artist for now if itemType in ('movie', 'show'): # and NOT artist for now
self.sorted_views[itemType].append(view.attrib['title']) self.sorted_views.append(view.attrib['title'])
self.logMsg('Sorted views: %s' % self.sorted_views, 1)
# total nodes for window properties
vnodes.clearProperties()
totalnodes = len(self.sorted_views)
with embydb.GetEmbyDB() as emby_db: with embydb.GetEmbyDB() as emby_db:
# Backup old views to delete them later, if needed (at the end # Backup old views to delete them later, if needed (at the end
@ -585,7 +582,6 @@ class LibrarySync(Thread):
kodi_db, kodi_db,
emby_db, emby_db,
totalnodes) totalnodes)
else:
# Add video nodes listings # Add video nodes listings
# Plex: there seem to be no favorites/favorites tag # Plex: there seem to be no favorites/favorites tag
# vnodes.singleNode(totalnodes, # vnodes.singleNode(totalnodes,
@ -598,11 +594,14 @@ class LibrarySync(Thread):
# "tvshows", # "tvshows",
# "favourites") # "favourites")
# totalnodes += 1 # totalnodes += 1
vnodes.singleNode(totalnodes, # vnodes.singleNode(totalnodes,
"channels", # "channels",
"movies", # "movies",
"channels") # "channels")
totalnodes += 1 # totalnodes += 1
with kodidb.GetKodiDB('music') as kodi_db:
pass
# Save total # Save total
utils.window('Emby.nodes.total', str(totalnodes)) utils.window('Emby.nodes.total', str(totalnodes))

View file

@ -42,6 +42,16 @@ class VideoNodes(object):
def viewNode(self, indexnumber, tagname, mediatype, viewtype, viewid, delete=False): def viewNode(self, indexnumber, tagname, mediatype, viewtype, viewid, delete=False):
# Plex: reassign mediatype due to Kodi inner workings
mediatypes = {
'movie': 'movies',
'show': 'tvshows',
'photo': 'photos',
'homevideo': 'homevideos',
'musicvideos': 'musicvideos'
}
mediatype = mediatypes[mediatype]
window = utils.window window = utils.window
kodiversion = self.kodiversion kodiversion = self.kodiversion
@ -116,7 +126,7 @@ class VideoNodes(object):
} }
mediatypes = { mediatypes = {
# label according to nodetype per mediatype # label according to nodetype per mediatype
'movie': 'movies':
{ {
'1': tagname, '1': tagname,
'2': 30174, '2': 30174,
@ -128,7 +138,7 @@ class VideoNodes(object):
'11': 30230 '11': 30230
}, },
'show': 'tvshows':
{ {
'1': tagname, '1': tagname,
'2': 30170, '2': 30170,
@ -141,14 +151,14 @@ class VideoNodes(object):
'11': 30230 '11': 30230
}, },
'homevideos': 'homevideoss':
{ {
'1': tagname, '1': tagname,
'2': 30251, '2': 30251,
'11': 30253 '11': 30253
}, },
'photo': 'photos':
{ {
'1': tagname, '1': tagname,
'2': 30252, '2': 30252,

View file

@ -85,7 +85,7 @@
<setting id="logLevel" type="enum" label="30004" values="Disabled|Info|Debug" default="1" /> <setting id="logLevel" type="enum" label="30004" values="Disabled|Info|Debug" default="1" />
<setting id="startupDelay" type="number" label="30529" default="0" option="int" /> <setting id="startupDelay" type="number" label="30529" default="0" option="int" />
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=reset)" option="close" /> <setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=reset)" option="close" />
<setting id="syncThreadNumber" type="number" label="Number of parallel threads while syncing" default="10" option="int"/> <setting id="syncThreadNumber" type="number" label="Number of parallel threads while syncing" default="5" option="int"/>
</category> </category>
<category label="Plex Companion"> <category label="Plex Companion">
<setting id="plexCompanion" label="Enable Plex Companion" type="bool" default="true" /> <setting id="plexCompanion" label="Enable Plex Companion" type="bool" default="true" />