mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Reduce warnings in MediaBrowser.Controller
This commit is contained in:
@@ -37,6 +37,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
public class Folder : BaseItem
|
||||
{
|
||||
public Folder()
|
||||
{
|
||||
LinkedChildren = Array.Empty<LinkedChild>();
|
||||
}
|
||||
|
||||
public static IUserViewManager UserViewManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -50,11 +55,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
[JsonIgnore]
|
||||
public DateTime? DateLastMediaAdded { get; set; }
|
||||
|
||||
public Folder()
|
||||
{
|
||||
LinkedChildren = Array.Empty<LinkedChild>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsThemeMedia => true;
|
||||
|
||||
@@ -86,6 +86,85 @@ namespace MediaBrowser.Controller.Entities
|
||||
[JsonIgnore]
|
||||
public virtual bool SupportsDateLastMediaAdded => false;
|
||||
|
||||
[JsonIgnore]
|
||||
public override string FileNameWithoutExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsFileProtocol)
|
||||
{
|
||||
return System.IO.Path.GetFileName(Path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the actual children.
|
||||
/// </summary>
|
||||
/// <value>The actual children.</value>
|
||||
[JsonIgnore]
|
||||
public virtual IEnumerable<BaseItem> Children => LoadChildren();
|
||||
|
||||
/// <summary>
|
||||
/// Gets thread-safe access to all recursive children of this folder - without regard to user.
|
||||
/// </summary>
|
||||
/// <value>The recursive children.</value>
|
||||
[JsonIgnore]
|
||||
public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
|
||||
|
||||
[JsonIgnore]
|
||||
protected virtual bool SupportsShortcutChildren => false;
|
||||
|
||||
protected virtual bool FilterLinkedChildrenPerUser => false;
|
||||
|
||||
[JsonIgnore]
|
||||
protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool SupportsUserDataFromChildren
|
||||
{
|
||||
get
|
||||
{
|
||||
// These are just far too slow.
|
||||
if (this is ICollectionFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is UserView)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is UserRootFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is Channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SourceType != SourceType.Library)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is IItemByName)
|
||||
{
|
||||
if (this is not IHasDualAccess hasDualAccess || hasDualAccess.IsAccessedByName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
{
|
||||
if (IsRoot)
|
||||
@@ -108,20 +187,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return baseResult;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public override string FileNameWithoutExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsFileProtocol)
|
||||
{
|
||||
return System.IO.Path.GetFileName(Path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool IsAllowTagFilterEnforced()
|
||||
{
|
||||
if (this is ICollectionFolder)
|
||||
@@ -137,9 +202,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
protected virtual bool SupportsShortcutChildren => false;
|
||||
|
||||
/// <summary>
|
||||
/// Adds the child.
|
||||
/// </summary>
|
||||
@@ -169,20 +231,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
LibraryManager.CreateItem(item, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the actual children.
|
||||
/// </summary>
|
||||
/// <value>The actual children.</value>
|
||||
[JsonIgnore]
|
||||
public virtual IEnumerable<BaseItem> Children => LoadChildren();
|
||||
|
||||
/// <summary>
|
||||
/// thread-safe access to all recursive children of this folder - without regard to user.
|
||||
/// </summary>
|
||||
/// <value>The recursive children.</value>
|
||||
[JsonIgnore]
|
||||
public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
{
|
||||
if (this is ICollectionFolder && !(this is BasePluginFolder))
|
||||
@@ -1428,8 +1476,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return list;
|
||||
}
|
||||
|
||||
protected virtual bool FilterLinkedChildrenPerUser => false;
|
||||
|
||||
public bool ContainsLinkedChildByItemId(Guid itemId)
|
||||
{
|
||||
var linkedChildren = LinkedChildren;
|
||||
@@ -1530,9 +1576,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
.Where(i => i.Item2 != null);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren;
|
||||
|
||||
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
||||
{
|
||||
var changesFound = false;
|
||||
@@ -1696,51 +1739,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return !IsPlayed(user);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool SupportsUserDataFromChildren
|
||||
{
|
||||
get
|
||||
{
|
||||
// These are just far too slow.
|
||||
if (this is ICollectionFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is UserView)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is UserRootFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this is Channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SourceType != SourceType.Library)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var iItemByName = this as IItemByName;
|
||||
if (iItemByName != null)
|
||||
{
|
||||
var hasDualAccess = this as IHasDualAccess;
|
||||
if (hasDualAccess == null || hasDualAccess.IsAccessedByName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields)
|
||||
{
|
||||
if (!SupportsUserDataFromChildren)
|
||||
|
||||
Reference in New Issue
Block a user