mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Fix views
GroupedFolders sometimes return empty, even if the user's views are grouped (seems like a bug). Added a failsafe.
This commit is contained in:
parent
c02c7ce242
commit
897780f059
1 changed files with 10 additions and 10 deletions
|
@ -382,8 +382,9 @@ class LibrarySync(threading.Thread):
|
||||||
result = doUtils(url)
|
result = doUtils(url)
|
||||||
grouped_views = result['Items']
|
grouped_views = result['Items']
|
||||||
ordered_views = emby.getViews(sortedlist=True)
|
ordered_views = emby.getViews(sortedlist=True)
|
||||||
sorted_views = []
|
all_views = []
|
||||||
for view in ordered_views:
|
for view in ordered_views:
|
||||||
|
all_views.append(view['name'])
|
||||||
if view['type'] == "music":
|
if view['type'] == "music":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -392,13 +393,6 @@ class LibrarySync(threading.Thread):
|
||||||
sorted_views.append(view['name'])
|
sorted_views.append(view['name'])
|
||||||
log("Sorted views: %s" % sorted_views, 1)
|
log("Sorted views: %s" % sorted_views, 1)
|
||||||
|
|
||||||
try:
|
|
||||||
groupedFolders = self.user.userSettings['Configuration']['GroupedFolders']
|
|
||||||
except TypeError:
|
|
||||||
url = "{server}/emby/Users/{UserId}?format=json"
|
|
||||||
result = doUtils(url)
|
|
||||||
groupedFolders = result['Configuration']['GroupedFolders']
|
|
||||||
|
|
||||||
# total nodes for window properties
|
# total nodes for window properties
|
||||||
vnodes.clearProperties()
|
vnodes.clearProperties()
|
||||||
totalnodes = len(sorted_views) + 0
|
totalnodes = len(sorted_views) + 0
|
||||||
|
@ -427,12 +421,12 @@ class LibrarySync(threading.Thread):
|
||||||
foldername = folder['name']
|
foldername = folder['name']
|
||||||
viewtype = folder['type']
|
viewtype = folder['type']
|
||||||
|
|
||||||
if folderid in groupedFolders:
|
if foldername not in all_views:
|
||||||
# Media folders are grouped into userview
|
# Media folders are grouped into userview
|
||||||
url = "{server}/emby/Users/{UserId}/Items?format=json"
|
url = "{server}/emby/Users/{UserId}/Items?format=json"
|
||||||
params = {
|
params = {
|
||||||
|
|
||||||
'ParentId': folderid,
|
'ParentId': folderid,
|
||||||
|
'Recursive': True,
|
||||||
'Limit': 1,
|
'Limit': 1,
|
||||||
'IncludeItemTypes': emby_mediatypes[mediatype]
|
'IncludeItemTypes': emby_mediatypes[mediatype]
|
||||||
} # Get one item from server using the folderid
|
} # Get one item from server using the folderid
|
||||||
|
@ -460,6 +454,12 @@ class LibrarySync(threading.Thread):
|
||||||
sorted_views.append(foldername)
|
sorted_views.append(foldername)
|
||||||
log("Couldn't find corresponding grouped view: %s" % sorted_views, 1)
|
log("Couldn't find corresponding grouped view: %s" % sorted_views, 1)
|
||||||
|
|
||||||
|
# Failsafe
|
||||||
|
try:
|
||||||
|
sorted_views.index(foldername)
|
||||||
|
except ValueError:
|
||||||
|
sorted_views.append(foldername)
|
||||||
|
|
||||||
# Get current media folders from emby database
|
# Get current media folders from emby database
|
||||||
view = emby_db.getView_byId(folderid)
|
view = emby_db.getView_byId(folderid)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue