Prevent errors during the view creation
For grouped folders only. Include the itemtype to make sure we can correctly search the reference under the grouped view.
This commit is contained in:
parent
ab467e36f0
commit
f16b5dfff6
1 changed files with 18 additions and 1 deletions
|
@ -385,6 +385,7 @@ class LibrarySync(threading.Thread):
|
||||||
if view['type'] == "mixed":
|
if view['type'] == "mixed":
|
||||||
sorted_views.append(view['name'])
|
sorted_views.append(view['name'])
|
||||||
sorted_views.append(view['name'])
|
sorted_views.append(view['name'])
|
||||||
|
log("Sorted views: %s" % sorted_views, 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
groupedFolders = self.user.userSettings['Configuration']['GroupedFolders']
|
groupedFolders = self.user.userSettings['Configuration']['GroupedFolders']
|
||||||
|
@ -399,6 +400,15 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
current_views = emby_db.getViews()
|
current_views = emby_db.getViews()
|
||||||
# Set views for supported media type
|
# Set views for supported media type
|
||||||
|
emby_mediatypes = {
|
||||||
|
|
||||||
|
'movies': "Movie",
|
||||||
|
'tvshows': "Series",
|
||||||
|
'musicvideos': "MusicVideo",
|
||||||
|
'homevideos': "Video",
|
||||||
|
'music': "Audio",
|
||||||
|
'photos': "Photo"
|
||||||
|
}
|
||||||
mediatypes = ['movies', 'tvshows', 'musicvideos', 'homevideos', 'music', 'photos']
|
mediatypes = ['movies', 'tvshows', 'musicvideos', 'homevideos', 'music', 'photos']
|
||||||
for mediatype in mediatypes:
|
for mediatype in mediatypes:
|
||||||
|
|
||||||
|
@ -416,8 +426,10 @@ class LibrarySync(threading.Thread):
|
||||||
# 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,
|
||||||
'Limit': 1
|
'Limit': 1,
|
||||||
|
'IncludeItemTypes': emby_mediatypes[mediatype]
|
||||||
} # Get one item from server using the folderid
|
} # Get one item from server using the folderid
|
||||||
result = doUtils(url, parameters=params)
|
result = doUtils(url, parameters=params)
|
||||||
try:
|
try:
|
||||||
|
@ -434,8 +446,13 @@ class LibrarySync(threading.Thread):
|
||||||
# Take the userview, and validate the item belong to the view
|
# Take the userview, and validate the item belong to the view
|
||||||
if emby.verifyView(grouped_view['Id'], verifyitem):
|
if emby.verifyView(grouped_view['Id'], verifyitem):
|
||||||
# Take the name of the userview
|
# Take the name of the userview
|
||||||
|
log("Found corresponding view: %s %s"
|
||||||
|
% (grouped_view['Name'], grouped_view['Id']), 1)
|
||||||
foldername = grouped_view['Name']
|
foldername = grouped_view['Name']
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
# Unable to find a match, add the name to our sorted_view list
|
||||||
|
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)
|
||||||
|
|
Loading…
Reference in a new issue