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

@ -21,22 +21,8 @@ namespace MediaBrowser.Server.Implementations.Devices
{ {
return false; return false;
} }
return GetChildren(user, true).Any() &&
base.IsVisible(user);
}
public override bool IsHidden return base.IsVisible(user) && HasChildren();
{
get
{
return base.IsHidden || !Children.Any();
}
}
public override bool IsHiddenFromUser(User user)
{
return false;
} }
public override string CollectionType public override string CollectionType
@ -48,6 +34,23 @@ namespace MediaBrowser.Server.Implementations.Devices
{ {
return typeof(CollectionFolder).Name; 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 public class CameraUploadsDynamicFolder : IVirtualFolderCreator
@ -65,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.Devices
{ {
var path = Path.Combine(_appPaths.DataPath, "camerauploads"); var path = Path.Combine(_appPaths.DataPath, "camerauploads");
_fileSystem.CreateDirectory(path); _fileSystem.CreateDirectory(path);
return new CameraUploadsFolder return new CameraUploadsFolder
{ {

View File

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