update special folders

This commit is contained in:
Luke Pulverenti 2015-10-30 11:23:06 -04:00
parent 50f6ee1039
commit 0ac0d6b878
2 changed files with 19 additions and 21 deletions

View File

@ -22,21 +22,7 @@ namespace MediaBrowser.Server.Implementations.Devices
return false;
}
return GetChildren(user, true).Any() &&
base.IsVisible(user);
}
public override bool IsHidden
{
get
{
return base.IsHidden || !Children.Any();
}
}
public override bool IsHiddenFromUser(User user)
{
return false;
return base.IsVisible(user) && HasChildren();
}
public override string CollectionType
@ -48,6 +34,23 @@ namespace MediaBrowser.Server.Implementations.Devices
{
return typeof(CollectionFolder).Name;
}
private bool? _hasChildren;
private bool HasChildren()
{
if (!_hasChildren.HasValue)
{
_hasChildren = LibraryManager.GetItemIds(new InternalItemsQuery { ParentId = Id }).Count > 0;
}
return _hasChildren.Value;
}
protected override System.Threading.Tasks.Task ValidateChildrenInternal(IProgress<double> progress, System.Threading.CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, Controller.Providers.MetadataRefreshOptions refreshOptions, Controller.Providers.IDirectoryService directoryService)
{
_hasChildren = null;
return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
}
}
public class CameraUploadsDynamicFolder : IVirtualFolderCreator

View File

@ -34,11 +34,6 @@ namespace MediaBrowser.Server.Implementations.Playlists
}
}
public override bool IsHiddenFromUser(User user)
{
return false;
}
public override string CollectionType
{
get { return Model.Entities.CollectionType.Playlists; }