jellyfin/MediaBrowser.Controller/Entities/UserRootFolder.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2014-02-12 22:11:54 -07:00
using MediaBrowser.Controller.Providers;
2014-02-10 13:11:46 -07:00
using System.Collections.Generic;
using System.Linq;
2013-02-20 18:33:05 -07:00
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Special class used for User Roots. Children contain actual ones defined for this user
/// PLUS the virtual folders from the physical root (added by plug-ins).
/// </summary>
public class UserRootFolder : Folder
{
/// <summary>
/// Get the children of this folder from the actual file system
/// </summary>
/// <returns>IEnumerable{BaseItem}.</returns>
2014-02-10 11:39:41 -07:00
protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
2013-02-20 18:33:05 -07:00
{
2014-02-08 15:38:02 -07:00
return base.GetNonCachedChildren(directoryService).Concat(LibraryManager.RootFolder.VirtualChildren);
2013-02-20 18:33:05 -07:00
}
2014-02-10 13:11:46 -07:00
2014-02-12 22:11:54 -07:00
public override bool BeforeMetadataRefresh()
2014-02-10 13:11:46 -07:00
{
2014-02-12 22:11:54 -07:00
var hasChanges = base.BeforeMetadataRefresh();
2014-02-10 13:11:46 -07:00
if (string.Equals("default", Name, System.StringComparison.OrdinalIgnoreCase))
{
Name = "Default Media Library";
2014-02-12 22:11:54 -07:00
hasChanges = true;
2014-02-10 13:11:46 -07:00
}
2014-02-12 22:11:54 -07:00
return hasChanges;
2014-02-10 13:11:46 -07:00
}
2013-02-20 18:33:05 -07:00
}
}