Skip to content
Permalink
Browse files
Merge pull request #6071 from BaronGreenback/DLNAFolderFixPart1
Make DLNA folders to work as expected.
  • Loading branch information
cvium committed Jun 7, 2021
2 parents 9963d0c + 48bb338 commit f17d43c56482015ffa39b6a1d807579d027eed58
@@ -987,7 +987,13 @@ protected virtual QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery quer
}
else
{
items = GetChildren(user, true).Where(filter);
// need to pass this param to the children.
var childQuery = new InternalItemsQuery
{
DisplayAlbumFolders = query.DisplayAlbumFolders
};

items = GetChildren(user, true, childQuery).Where(filter);
}

return PostFilterAndSort(items, query, true);
@@ -1325,7 +1331,21 @@ protected virtual IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(
/// </summary>
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
{
foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
// If Query.AlbumFolders is set, then enforce the format as per the db in that it permits sub-folders in music albums.
IEnumerable<BaseItem> children = null;
if ((query?.DisplayAlbumFolders ?? false) && (this is MusicAlbum))
{
children = Children;
query = null;
}

// If there are not sub-folders, proceed as normal.
if (children == null)
{
children = GetEligibleChildrenForRecursiveChildren(user);
}

foreach (var child in children)
{
bool? isVisibleToUser = null;

@@ -265,6 +265,11 @@ public class InternalItemsQuery

public bool? IsDeadPerson { get; set; }

/// <summary>
/// Gets or sets a value indicating whether album sub-folders should be returned if they exist.
/// </summary>
public bool? DisplayAlbumFolders { get; set; }

public InternalItemsQuery()
{
AlbumArtistIds = Array.Empty<Guid>();

0 comments on commit f17d43c

Please sign in to comment.