aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/Folder.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-12-06 12:06:13 +0100
committerBond-009 <bond.009@outlook.com>2019-12-06 12:06:13 +0100
commita2c35e6dba02f068a3f06e5a4e4964e6539069d1 (patch)
treee75984ab85fedceaf96150ad9d5241cf88230a60 /MediaBrowser.Controller/Entities/Folder.cs
parent94edb5b9f98cf3b06144255eccc988712332f0a8 (diff)
parent935525e77a18061195dea786be71d38fffe82a10 (diff)
Merge remote-tracking branch 'upstream/master' into random
Diffstat (limited to 'MediaBrowser.Controller/Entities/Folder.cs')
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs41
1 files changed, 23 insertions, 18 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 8e9d11012..07fbe6035 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Progress;
@@ -18,7 +19,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
-using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities
@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities
public LinkedChild[] LinkedChildren { get; set; }
- [IgnoreDataMember]
+ [JsonIgnore]
public DateTime? DateLastMediaAdded { get; set; }
public Folder()
@@ -47,35 +47,35 @@ namespace MediaBrowser.Controller.Entities
LinkedChildren = Array.Empty<LinkedChild>();
}
- [IgnoreDataMember]
+ [JsonIgnore]
public override bool SupportsThemeMedia => true;
- [IgnoreDataMember]
+ [JsonIgnore]
public virtual bool IsPreSorted => false;
- [IgnoreDataMember]
+ [JsonIgnore]
public virtual bool IsPhysicalRoot => false;
- [IgnoreDataMember]
+ [JsonIgnore]
public override bool SupportsInheritedParentImages => true;
- [IgnoreDataMember]
+ [JsonIgnore]
public override bool SupportsPlayedStatus => true;
/// <summary>
/// Gets a value indicating whether this instance is folder.
/// </summary>
/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
- [IgnoreDataMember]
+ [JsonIgnore]
public override bool IsFolder => true;
- [IgnoreDataMember]
+ [JsonIgnore]
public override bool IsDisplayedAsFolder => true;
- [IgnoreDataMember]
+ [JsonIgnore]
public virtual bool SupportsCumulativeRunTimeTicks => false;
- [IgnoreDataMember]
+ [JsonIgnore]
public virtual bool SupportsDateLastMediaAdded => false;
public override bool CanDelete()
@@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Entities
return baseResult;
}
- [IgnoreDataMember]
+ [JsonIgnore]
public override string FileNameWithoutExtension
{
get
@@ -127,7 +127,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
- [IgnoreDataMember]
+ [JsonIgnore]
protected virtual bool SupportsShortcutChildren => false;
/// <summary>
@@ -162,14 +162,14 @@ namespace MediaBrowser.Controller.Entities
/// Gets the actual children.
/// </summary>
/// <value>The actual children.</value>
- [IgnoreDataMember]
+ [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>
- [IgnoreDataMember]
+ [JsonIgnore]
public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
public override bool IsVisible(User user)
@@ -216,7 +216,7 @@ namespace MediaBrowser.Controller.Entities
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken)
{
- return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)));
+ return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(FileSystem)));
}
/// <summary>
@@ -1152,6 +1152,11 @@ namespace MediaBrowser.Controller.Entities
public List<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
+ if (user == null)
+ {
+ throw new ArgumentNullException(nameof(user));
+ }
+
return GetChildren(user, includeLinkedChildren, null);
}
@@ -1431,7 +1436,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i.Item2 != null);
}
- [IgnoreDataMember]
+ [JsonIgnore]
protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren;
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
@@ -1598,7 +1603,7 @@ namespace MediaBrowser.Controller.Entities
return !IsPlayed(user);
}
- [IgnoreDataMember]
+ [JsonIgnore]
public virtual bool SupportsUserDataFromChildren
{
get