mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Fix views duplicate at the root
This commit is contained in:
parent
2f3d9c4a60
commit
1388f4b27b
2 changed files with 18 additions and 17 deletions
|
@ -60,7 +60,6 @@ def doMainListing():
|
|||
xbmcplugin.setContent(int(sys.argv[1]), 'files')
|
||||
# Get emby nodes from the window props
|
||||
embyprops = utils.window('Emby.nodes.total')
|
||||
nodes = []
|
||||
if embyprops:
|
||||
totalnodes = int(embyprops)
|
||||
for i in range(totalnodes):
|
||||
|
@ -69,10 +68,6 @@ def doMainListing():
|
|||
path = utils.window('Emby.nodes.%s.content' % i)
|
||||
label = utils.window('Emby.nodes.%s.title' % i)
|
||||
type = utils.window('Emby.nodes.%s.type' % i)
|
||||
if label not in nodes:
|
||||
nodes.append(label)
|
||||
else: # Avoid duplicates
|
||||
continue
|
||||
#because we do not use seperate entrypoints for each content type, we need to figure out which items to show in each listing.
|
||||
#for now we just only show picture nodes in the picture library video nodes in the video library and all nodes in any other window
|
||||
if path and xbmc.getCondVisibility("Window.IsActive(Pictures)") and type == "photos":
|
||||
|
|
|
@ -388,6 +388,7 @@ class LibrarySync(threading.Thread):
|
|||
mediatypes = ['movies', 'tvshows', 'musicvideos', 'homevideos', 'music', 'photos']
|
||||
for mediatype in mediatypes:
|
||||
|
||||
nodes = [] # Prevent duplicate for nodes of the same type
|
||||
# Get media folders from server
|
||||
folders = self.emby.getViews(mediatype, root=True)
|
||||
for folder in folders:
|
||||
|
@ -418,11 +419,13 @@ class LibrarySync(threading.Thread):
|
|||
self.logMsg("Creating viewid: %s in Emby database." % folderid, 1)
|
||||
tagid = kodi_db.createTag(foldername)
|
||||
# Create playlist for the video library
|
||||
if mediatype in ['movies', 'tvshows', 'musicvideos']:
|
||||
if mediatype in ('movies', 'tvshows', 'musicvideos'):
|
||||
utils.playlistXSP(mediatype, foldername, viewtype)
|
||||
# Create the video node
|
||||
if mediatype in ['movies', 'tvshows', 'musicvideos', 'homevideos']:
|
||||
if (foldername not in nodes and
|
||||
mediatype in ('movies', 'tvshows', 'musicvideos', 'homevideos')):
|
||||
vnodes.viewNode(totalnodes, foldername, mediatype, viewtype)
|
||||
nodes.append(foldername)
|
||||
totalnodes += 1
|
||||
# Add view to emby database
|
||||
emby_db.addView(folderid, foldername, viewtype, tagid)
|
||||
|
@ -458,11 +461,13 @@ class LibrarySync(threading.Thread):
|
|||
viewtype=current_viewtype,
|
||||
delete=True)
|
||||
# Added new playlist
|
||||
if mediatype in ['movies', 'tvshows', 'musicvideos']:
|
||||
if mediatype in ('movies', 'tvshows', 'musicvideos'):
|
||||
utils.playlistXSP(mediatype, foldername, viewtype)
|
||||
# Add new video node
|
||||
if mediatype != "musicvideos":
|
||||
if (foldername not in nodes and
|
||||
mediatype in ('movies', 'tvshows', 'musicvideos', 'homevideos')):
|
||||
vnodes.viewNode(totalnodes, foldername, mediatype, viewtype)
|
||||
nodes.append(foldername)
|
||||
totalnodes += 1
|
||||
|
||||
# Update items with new tag
|
||||
|
@ -472,14 +477,15 @@ class LibrarySync(threading.Thread):
|
|||
kodi_db.updateTag(
|
||||
current_tagid, tagid, item[0], current_viewtype[:-1])
|
||||
else:
|
||||
if mediatype != "music":
|
||||
# Validate the playlist exists or recreate it
|
||||
if mediatype in ['movies', 'tvshows', 'musicvideos']:
|
||||
utils.playlistXSP(mediatype, foldername, viewtype)
|
||||
# Create the video node if not already exists
|
||||
if mediatype != "musicvideos":
|
||||
vnodes.viewNode(totalnodes, foldername, mediatype, viewtype)
|
||||
totalnodes += 1
|
||||
# Validate the playlist exists or recreate it
|
||||
if mediatype in ('movies', 'tvshows', 'musicvideos'):
|
||||
utils.playlistXSP(mediatype, foldername, viewtype)
|
||||
# Create the video node if not already exists
|
||||
if (foldername not in nodes and
|
||||
mediatype in ('movies', 'tvshows', 'musicvideos', 'homevideos')):
|
||||
vnodes.viewNode(totalnodes, foldername, mediatype, viewtype)
|
||||
nodes.append(foldername)
|
||||
totalnodes += 1
|
||||
else:
|
||||
# Add video nodes listings
|
||||
vnodes.singleNode(totalnodes, "Favorite movies", "movies", "favourites")
|
||||
|
|
Loading…
Reference in a new issue