Merge pull request #6339 from richlander/mediabrowser-controller-entities

This commit is contained in:
Bond-009 2021-08-13 18:07:19 +02:00 committed by GitHub
commit 04571e93f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 312 additions and 306 deletions

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1819, CS1591
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@ -18,32 +18,23 @@ namespace MediaBrowser.Controller.Entities
{ {
/// <summary> /// <summary>
/// Specialized folder that can have items added to it's children by external entities. /// Specialized folder that can have items added to it's children by external entities.
/// Used for our RootFolder so plug-ins can add items. /// Used for our RootFolder so plugins can add items.
/// </summary> /// </summary>
public class AggregateFolder : Folder public class AggregateFolder : Folder
{ {
private bool _requiresRefresh; private readonly object _childIdsLock = new object();
public AggregateFolder()
{
PhysicalLocationsList = Array.Empty<string>();
}
[JsonIgnore]
public override bool IsPhysicalRoot => true;
public override bool CanDelete()
{
return false;
}
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
/// <summary> /// <summary>
/// The _virtual children. /// The _virtual children.
/// </summary> /// </summary>
private readonly ConcurrentBag<BaseItem> _virtualChildren = new ConcurrentBag<BaseItem>(); private readonly ConcurrentBag<BaseItem> _virtualChildren = new ConcurrentBag<BaseItem>();
private bool _requiresRefresh;
private Guid[] _childrenIds = null;
public AggregateFolder()
{
PhysicalLocationsList = Array.Empty<string>();
}
/// <summary> /// <summary>
/// Gets the virtual children. /// Gets the virtual children.
@ -51,19 +42,27 @@ namespace MediaBrowser.Controller.Entities
/// <value>The virtual children.</value> /// <value>The virtual children.</value>
public ConcurrentBag<BaseItem> VirtualChildren => _virtualChildren; public ConcurrentBag<BaseItem> VirtualChildren => _virtualChildren;
[JsonIgnore]
public override bool IsPhysicalRoot => true;
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
[JsonIgnore] [JsonIgnore]
public override string[] PhysicalLocations => PhysicalLocationsList; public override string[] PhysicalLocations => PhysicalLocationsList;
public string[] PhysicalLocationsList { get; set; } public string[] PhysicalLocationsList { get; set; }
public override bool CanDelete()
{
return false;
}
protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
{ {
return CreateResolveArgs(directoryService, true).FileSystemChildren; return CreateResolveArgs(directoryService, true).FileSystemChildren;
} }
private Guid[] _childrenIds = null;
private readonly object _childIdsLock = new object();
protected override List<BaseItem> LoadChildren() protected override List<BaseItem> LoadChildren()
{ {
lock (_childIdsLock) lock (_childIdsLock)
@ -169,7 +168,7 @@ namespace MediaBrowser.Controller.Entities
/// Adds the virtual child. /// Adds the virtual child.
/// </summary> /// </summary>
/// <param name="child">The child.</param> /// <param name="child">The child.</param>
/// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentNullException">Throws if child is null.</exception>
public void AddVirtualChild(BaseItem child) public void AddVirtualChild(BaseItem child)
{ {
if (child == null) if (child == null)

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1002, CA1724, CA1826, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -25,6 +25,12 @@ namespace MediaBrowser.Controller.Entities.Audio
IHasLookupInfo<SongInfo>, IHasLookupInfo<SongInfo>,
IHasMediaSources IHasMediaSources
{ {
public Audio()
{
Artists = Array.Empty<string>();
AlbumArtists = Array.Empty<string>();
}
/// <inheritdoc /> /// <inheritdoc />
[JsonIgnore] [JsonIgnore]
public IReadOnlyList<string> Artists { get; set; } public IReadOnlyList<string> Artists { get; set; }
@ -33,17 +39,6 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public IReadOnlyList<string> AlbumArtists { get; set; } public IReadOnlyList<string> AlbumArtists { get; set; }
public Audio()
{
Artists = Array.Empty<string>();
AlbumArtists = Array.Empty<string>();
}
public override double GetDefaultPrimaryImageAspectRatio()
{
return 1;
}
[JsonIgnore] [JsonIgnore]
public override bool SupportsPlayedStatus => true; public override bool SupportsPlayedStatus => true;
@ -62,11 +57,6 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public override Folder LatestItemsIndexContainer => AlbumEntity; public override Folder LatestItemsIndexContainer => AlbumEntity;
public override bool CanDownload()
{
return IsFileProtocol;
}
[JsonIgnore] [JsonIgnore]
public MusicAlbum AlbumEntity => FindParent<MusicAlbum>(); public MusicAlbum AlbumEntity => FindParent<MusicAlbum>();
@ -77,6 +67,16 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public override string MediaType => Model.Entities.MediaType.Audio; public override string MediaType => Model.Entities.MediaType.Audio;
public override double GetDefaultPrimaryImageAspectRatio()
{
return 1;
}
public override bool CanDownload()
{
return IsFileProtocol;
}
/// <summary> /// <summary>
/// Creates the name of the sort. /// Creates the name of the sort.
/// </summary> /// </summary>

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1819, CS1591
namespace MediaBrowser.Controller.Entities.Audio namespace MediaBrowser.Controller.Entities.Audio
{ {

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1721, CA1826, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -23,18 +23,18 @@ namespace MediaBrowser.Controller.Entities.Audio
/// </summary> /// </summary>
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer
{ {
/// <inheritdoc />
public IReadOnlyList<string> AlbumArtists { get; set; }
/// <inheritdoc />
public IReadOnlyList<string> Artists { get; set; }
public MusicAlbum() public MusicAlbum()
{ {
Artists = Array.Empty<string>(); Artists = Array.Empty<string>();
AlbumArtists = Array.Empty<string>(); AlbumArtists = Array.Empty<string>();
} }
/// <inheritdoc />
public IReadOnlyList<string> AlbumArtists { get; set; }
/// <inheritdoc />
public IReadOnlyList<string> Artists { get; set; }
[JsonIgnore] [JsonIgnore]
public override bool SupportsAddingToPlaylist => true; public override bool SupportsAddingToPlaylist => true;
@ -44,6 +44,25 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public MusicArtist MusicArtist => GetMusicArtist(new DtoOptions(true)); public MusicArtist MusicArtist => GetMusicArtist(new DtoOptions(true));
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
[JsonIgnore]
public override bool SupportsCumulativeRunTimeTicks => true;
[JsonIgnore]
public string AlbumArtist => AlbumArtists.FirstOrDefault();
[JsonIgnore]
public override bool SupportsPeople => false;
/// <summary>
/// Gets the tracks.
/// </summary>
/// <value>The tracks.</value>
[JsonIgnore]
public IEnumerable<Audio> Tracks => GetRecursiveChildren(i => i is Audio).Cast<Audio>();
public MusicArtist GetMusicArtist(DtoOptions options) public MusicArtist GetMusicArtist(DtoOptions options)
{ {
var parents = GetParents(); var parents = GetParents();
@ -64,25 +83,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return null; return null;
} }
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
[JsonIgnore]
public override bool SupportsCumulativeRunTimeTicks => true;
[JsonIgnore]
public string AlbumArtist => AlbumArtists.FirstOrDefault();
[JsonIgnore]
public override bool SupportsPeople => false;
/// <summary>
/// Gets the tracks.
/// </summary>
/// <value>The tracks.</value>
[JsonIgnore]
public IEnumerable<Audio> Tracks => GetRecursiveChildren(i => i is Audio).Cast<Audio>();
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user) protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{ {
return Tracks; return Tracks;

View file

@ -44,6 +44,36 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public override bool SupportsPlayedStatus => false; public override bool SupportsPlayedStatus => false;
/// <summary>
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
public override string ContainingFolderPath => Path;
[JsonIgnore]
public override IEnumerable<BaseItem> Children
{
get
{
if (IsAccessedByName)
{
return new List<BaseItem>();
}
return base.Children;
}
}
[JsonIgnore]
public override bool SupportsPeople => false;
public static string GetPath(string name)
{
return GetPath(name, true);
}
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
{ {
return 1; return 1;
@ -65,20 +95,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return LibraryManager.GetItemList(query); return LibraryManager.GetItemList(query);
} }
[JsonIgnore]
public override IEnumerable<BaseItem> Children
{
get
{
if (IsAccessedByName)
{
return new List<BaseItem>();
}
return base.Children;
}
}
public override int GetChildCount(User user) public override int GetChildCount(User user)
{ {
return IsAccessedByName ? 0 : base.GetChildCount(user); return IsAccessedByName ? 0 : base.GetChildCount(user);
@ -113,14 +129,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return list; return list;
} }
/// <summary>
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
public override string ContainingFolderPath => Path;
/// <summary> /// <summary>
/// Gets the user data key. /// Gets the user data key.
/// </summary> /// </summary>
@ -167,14 +175,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return info; return info;
} }
[JsonIgnore]
public override bool SupportsPeople => false;
public static string GetPath(string name)
{
return GetPath(name, true);
}
public static string GetPath(string name, bool normalizeName) public static string GetPath(string name, bool normalizeName)
{ {
// Trim the period at the end because windows will have a hard time with that // Trim the period at the end because windows will have a hard time with that
@ -208,6 +208,8 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary> /// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made. /// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary> /// </summary>
/// <param name="replaceAllMetadata">Option to replace metadata.</param>
/// <returns>True if metadata changed.</returns>
public override bool BeforeMetadataRefresh(bool replaceAllMetadata) public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{ {
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata); var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);

View file

@ -15,19 +15,6 @@ namespace MediaBrowser.Controller.Entities.Audio
/// </summary> /// </summary>
public class MusicGenre : BaseItem, IItemByName public class MusicGenre : BaseItem, IItemByName
{ {
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
}
[JsonIgnore] [JsonIgnore]
public override bool SupportsAddingToPlaylist => true; public override bool SupportsAddingToPlaylist => true;
@ -45,6 +32,22 @@ namespace MediaBrowser.Controller.Entities.Audio
[JsonIgnore] [JsonIgnore]
public override string ContainingFolderPath => Path; public override string ContainingFolderPath => Path;
[JsonIgnore]
public override bool SupportsPeople => false;
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
}
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
{ {
return 1; return 1;
@ -60,9 +63,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return true; return true;
} }
[JsonIgnore]
public override bool SupportsPeople => false;
public IList<BaseItem> GetTaggedItems(InternalItemsQuery query) public IList<BaseItem> GetTaggedItems(InternalItemsQuery query)
{ {
query.GenreIds = new[] { Id }; query.GenreIds = new[] { Id };
@ -106,6 +106,8 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary> /// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made. /// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary> /// </summary>
/// <param name="replaceAllMetadata">Option to replace metadata.</param>
/// <returns>True if metadata changed.</returns>
public override bool BeforeMetadataRefresh(bool replaceAllMetadata) public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{ {
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata); var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1724, CS1591
using System; using System;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1002, CA1721, CA1819, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -165,6 +165,8 @@ namespace MediaBrowser.Controller.Entities
} }
} }
public static ICollectionManager CollectionManager { get; set; }
public override bool CanDelete() public override bool CanDelete()
{ {
if (IsRoot) if (IsRoot)
@ -258,6 +260,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads our children. Validation will occur externally. /// Loads our children. Validation will occur externally.
/// We want this synchronous. /// We want this synchronous.
/// </summary> /// </summary>
/// <returns>Returns children.</returns>
protected virtual List<BaseItem> LoadChildren() protected virtual List<BaseItem> LoadChildren()
{ {
// logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path); // logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
@ -642,6 +645,8 @@ namespace MediaBrowser.Controller.Entities
/// Get the children of this folder from the actual file system. /// Get the children of this folder from the actual file system.
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseItem}.</returns> /// <returns>IEnumerable{BaseItem}.</returns>
/// <param name="directoryService">The directory service to use for operation.</param>
/// <returns>Returns set of base items.</returns>
protected virtual IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService) protected virtual IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
{ {
var collectionType = LibraryManager.GetContentType(this); var collectionType = LibraryManager.GetContentType(this);
@ -998,8 +1003,6 @@ namespace MediaBrowser.Controller.Entities
return PostFilterAndSort(items, query, true); return PostFilterAndSort(items, query, true);
} }
public static ICollectionManager CollectionManager { get; set; }
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query, bool enableSorting) protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query, bool enableSorting)
{ {
var user = query.User; var user = query.User;

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1819, CS1591
using System; using System;

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1819, CS1591
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View file

@ -1,4 +1,4 @@
#pragma warning disable CS1591 #pragma warning disable CA1044, CA1819, CA2227, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -12,6 +12,55 @@ namespace MediaBrowser.Controller.Entities
{ {
public class InternalItemsQuery public class InternalItemsQuery
{ {
public InternalItemsQuery()
{
AlbumArtistIds = Array.Empty<Guid>();
AlbumIds = Array.Empty<Guid>();
AncestorIds = Array.Empty<Guid>();
ArtistIds = Array.Empty<Guid>();
BlockUnratedItems = Array.Empty<UnratedItem>();
BoxSetLibraryFolders = Array.Empty<Guid>();
ChannelIds = Array.Empty<Guid>();
ContributingArtistIds = Array.Empty<Guid>();
DtoOptions = new DtoOptions();
EnableTotalRecordCount = true;
ExcludeArtistIds = Array.Empty<Guid>();
ExcludeInheritedTags = Array.Empty<string>();
ExcludeItemIds = Array.Empty<Guid>();
ExcludeItemTypes = Array.Empty<string>();
ExcludeTags = Array.Empty<string>();
GenreIds = Array.Empty<Guid>();
Genres = Array.Empty<string>();
GroupByPresentationUniqueKey = true;
ImageTypes = Array.Empty<ImageType>();
IncludeItemTypes = Array.Empty<string>();
ItemIds = Array.Empty<Guid>();
MediaTypes = Array.Empty<string>();
MinSimilarityScore = 20;
OfficialRatings = Array.Empty<string>();
OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
PersonIds = Array.Empty<Guid>();
PersonTypes = Array.Empty<string>();
PresetViews = Array.Empty<string>();
SeriesStatuses = Array.Empty<SeriesStatus>();
SourceTypes = Array.Empty<SourceType>();
StudioIds = Array.Empty<Guid>();
Tags = Array.Empty<string>();
TopParentIds = Array.Empty<Guid>();
TrailerTypes = Array.Empty<TrailerType>();
VideoTypes = Array.Empty<VideoType>();
Years = Array.Empty<int>();
}
public InternalItemsQuery(User? user)
: this()
{
if (user != null)
{
SetUser(user);
}
}
public bool Recursive { get; set; } public bool Recursive { get; set; }
public int? StartIndex { get; set; } public int? StartIndex { get; set; }
@ -186,23 +235,6 @@ namespace MediaBrowser.Controller.Entities
public Guid[] TopParentIds { get; set; } public Guid[] TopParentIds { get; set; }
public BaseItem? Parent
{
set
{
if (value == null)
{
ParentId = Guid.Empty;
ParentType = null;
}
else
{
ParentId = value.Id;
ParentType = value.GetType().Name;
}
}
}
public string[] PresetViews { get; set; } public string[] PresetViews { get; set; }
public TrailerType[] TrailerTypes { get; set; } public TrailerType[] TrailerTypes { get; set; }
@ -270,72 +302,23 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
public bool? DisplayAlbumFolders { get; set; } public bool? DisplayAlbumFolders { get; set; }
public InternalItemsQuery() public BaseItem? Parent
{ {
AlbumArtistIds = Array.Empty<Guid>(); set
AlbumIds = Array.Empty<Guid>();
AncestorIds = Array.Empty<Guid>();
ArtistIds = Array.Empty<Guid>();
BlockUnratedItems = Array.Empty<UnratedItem>();
BoxSetLibraryFolders = Array.Empty<Guid>();
ChannelIds = Array.Empty<Guid>();
ContributingArtistIds = Array.Empty<Guid>();
DtoOptions = new DtoOptions();
EnableTotalRecordCount = true;
ExcludeArtistIds = Array.Empty<Guid>();
ExcludeInheritedTags = Array.Empty<string>();
ExcludeItemIds = Array.Empty<Guid>();
ExcludeItemTypes = Array.Empty<string>();
ExcludeTags = Array.Empty<string>();
GenreIds = Array.Empty<Guid>();
Genres = Array.Empty<string>();
GroupByPresentationUniqueKey = true;
ImageTypes = Array.Empty<ImageType>();
IncludeItemTypes = Array.Empty<string>();
ItemIds = Array.Empty<Guid>();
MediaTypes = Array.Empty<string>();
MinSimilarityScore = 20;
OfficialRatings = Array.Empty<string>();
OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
PersonIds = Array.Empty<Guid>();
PersonTypes = Array.Empty<string>();
PresetViews = Array.Empty<string>();
SeriesStatuses = Array.Empty<SeriesStatus>();
SourceTypes = Array.Empty<SourceType>();
StudioIds = Array.Empty<Guid>();
Tags = Array.Empty<string>();
TopParentIds = Array.Empty<Guid>();
TrailerTypes = Array.Empty<TrailerType>();
VideoTypes = Array.Empty<VideoType>();
Years = Array.Empty<int>();
}
public InternalItemsQuery(User? user)
: this()
{
if (user != null)
{ {
SetUser(user); if (value == null)
{
ParentId = Guid.Empty;
ParentType = null;
}
else
{
ParentId = value.Id;
ParentType = value.GetType().Name;
}
} }
} }
public void SetUser(User user)
{
MaxParentalRating = user.MaxParentalAgeRating;
if (MaxParentalRating.HasValue)
{
string other = UnratedItem.Other.ToString();
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
.Where(i => i != other)
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
}
ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
User = user;
}
public Dictionary<string, string>? HasAnyProviderId { get; set; } public Dictionary<string, string>? HasAnyProviderId { get; set; }
public Guid[] AlbumArtistIds { get; set; } public Guid[] AlbumArtistIds { get; set; }
@ -361,5 +344,22 @@ namespace MediaBrowser.Controller.Entities
public string? SearchTerm { get; set; } public string? SearchTerm { get; set; }
public string? SeriesTimerId { get; set; } public string? SeriesTimerId { get; set; }
public void SetUser(User user)
{
MaxParentalRating = user.MaxParentalAgeRating;
if (MaxParentalRating.HasValue)
{
string other = UnratedItem.Other.ToString();
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
.Where(i => i != other)
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
}
ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
User = user;
}
} }
} }

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1721, CA1819, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -49,6 +49,30 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <value>The display order.</value> /// <value>The display order.</value>
public string DisplayOrder { get; set; } public string DisplayOrder { get; set; }
[JsonIgnore]
private bool IsLegacyBoxSet
{
get
{
if (string.IsNullOrEmpty(Path))
{
return false;
}
if (LinkedChildren.Length > 0)
{
return false;
}
return !FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, Path);
}
}
[JsonIgnore]
public override bool IsPreSorted => true;
public Guid[] LibraryFolderIds { get; set; }
protected override bool GetBlockUnratedValue(User user) protected override bool GetBlockUnratedValue(User user)
{ {
return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie); return user.GetPreferenceValues<UnratedItem>(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie);
@ -83,28 +107,6 @@ namespace MediaBrowser.Controller.Entities.Movies
return new List<BaseItem>(); return new List<BaseItem>();
} }
[JsonIgnore]
private bool IsLegacyBoxSet
{
get
{
if (string.IsNullOrEmpty(Path))
{
return false;
}
if (LinkedChildren.Length > 0)
{
return false;
}
return !FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, Path);
}
}
[JsonIgnore]
public override bool IsPreSorted => true;
public override bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders) public override bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
{ {
return true; return true;
@ -191,8 +193,6 @@ namespace MediaBrowser.Controller.Entities.Movies
return IsVisible(user); return IsVisible(user);
} }
public Guid[] LibraryFolderIds { get; set; }
private Guid[] GetLibraryFolderIds(User user) private Guid[] GetLibraryFolderIds(User user)
{ {
return LibraryManager.GetUserRootFolder().GetChildren(user, true) return LibraryManager.GetUserRootFolder().GetChildren(user, true)

View file

@ -16,6 +16,26 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
public class Person : BaseItem, IItemByName, IHasLookupInfo<PersonLookupInfo> public class Person : BaseItem, IItemByName, IHasLookupInfo<PersonLookupInfo>
{ {
/// <summary>
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
public override string ContainingFolderPath => Path;
/// <summary>
/// Gets a value indicating whether to enable alpha numeric sorting.
/// </summary>
[JsonIgnore]
public override bool EnableAlphaNumericSorting => false;
[JsonIgnore]
public override bool SupportsPeople => false;
[JsonIgnore]
public override bool SupportsAncestors => false;
public override List<string> GetUserDataKeys() public override List<string> GetUserDataKeys()
{ {
var list = base.GetUserDataKeys(); var list = base.GetUserDataKeys();
@ -49,14 +69,6 @@ namespace MediaBrowser.Controller.Entities
return LibraryManager.GetItemList(query); return LibraryManager.GetItemList(query);
} }
/// <summary>
/// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
public override string ContainingFolderPath => Path;
public override bool CanDelete() public override bool CanDelete()
{ {
return false; return false;
@ -67,18 +79,6 @@ namespace MediaBrowser.Controller.Entities
return true; return true;
} }
/// <summary>
/// Gets a value indicating whether to enable alpha numeric sorting.
/// </summary>
[JsonIgnore]
public override bool EnableAlphaNumericSorting => false;
[JsonIgnore]
public override bool SupportsPeople => false;
[JsonIgnore]
public override bool SupportsAncestors => false;
public static string GetPath(string name) public static string GetPath(string name)
{ {
return GetPath(name, true); return GetPath(name, true);

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA2227, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View file

@ -36,6 +36,30 @@ namespace MediaBrowser.Controller.Entities
} }
} }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? Orientation { get; set; }
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public double? Altitude { get; set; }
public int? IsoSpeedRating { get; set; }
public override bool CanDownload() public override bool CanDownload()
{ {
return true; return true;
@ -69,29 +93,5 @@ namespace MediaBrowser.Controller.Entities
return base.GetDefaultPrimaryImageAspectRatio(); return base.GetDefaultPrimaryImageAspectRatio();
} }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? Orientation { get; set; }
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public double? Altitude { get; set; }
public int? IsoSpeedRating { get; set; }
} }
} }

View file

@ -15,19 +15,6 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
public class Studio : BaseItem, IItemByName public class Studio : BaseItem, IItemByName
{ {
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
}
/// <summary> /// <summary>
/// Gets the folder containing the item. /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself. /// If the item is a folder, it returns the folder itself.
@ -42,6 +29,22 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore] [JsonIgnore]
public override bool SupportsAncestors => false; public override bool SupportsAncestors => false;
[JsonIgnore]
public override bool SupportsPeople => false;
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
}
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
{ {
double value = 16; double value = 16;
@ -67,9 +70,6 @@ namespace MediaBrowser.Controller.Entities
return LibraryManager.GetItemList(query); return LibraryManager.GetItemList(query);
} }
[JsonIgnore]
public override bool SupportsPeople => false;
public static string GetPath(string name) public static string GetPath(string name)
{ {
return GetPath(name, true); return GetPath(name, true);

View file

@ -1,6 +1,6 @@
#nullable disable #nullable disable
#pragma warning disable CS1591 #pragma warning disable CA1819, CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -23,6 +23,9 @@ namespace MediaBrowser.Controller.Entities
TrailerTypes = Array.Empty<TrailerType>(); TrailerTypes = Array.Empty<TrailerType>();
} }
[JsonIgnore]
public override bool StopRefreshIfLocalMetadataFound => false;
public TrailerType[] TrailerTypes { get; set; } public TrailerType[] TrailerTypes { get; set; }
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
@ -97,8 +100,5 @@ namespace MediaBrowser.Controller.Entities
return list; return list;
} }
[JsonIgnore]
public override bool StopRefreshIfLocalMetadataFound => false;
} }
} }

View file

@ -15,13 +15,11 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
public class Year : BaseItem, IItemByName public class Year : BaseItem, IItemByName
{ {
public override List<string> GetUserDataKeys() [JsonIgnore]
{ public override bool SupportsAncestors => false;
var list = base.GetUserDataKeys();
list.Insert(0, "Year-" + Name); [JsonIgnore]
return list; public override bool SupportsPeople => false;
}
/// <summary> /// <summary>
/// Gets the folder containing the item. /// Gets the folder containing the item.
@ -31,6 +29,19 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore] [JsonIgnore]
public override string ContainingFolderPath => Path; public override string ContainingFolderPath => Path;
public override bool CanDelete()
{
return false;
}
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
list.Insert(0, "Year-" + Name);
return list;
}
public override double GetDefaultPrimaryImageAspectRatio() public override double GetDefaultPrimaryImageAspectRatio()
{ {
double value = 2; double value = 2;
@ -39,14 +50,6 @@ namespace MediaBrowser.Controller.Entities
return value; return value;
} }
[JsonIgnore]
public override bool SupportsAncestors => false;
public override bool CanDelete()
{
return false;
}
public override bool IsSaveLocalMetadataEnabled() public override bool IsSaveLocalMetadataEnabled()
{ {
return true; return true;
@ -76,9 +79,6 @@ namespace MediaBrowser.Controller.Entities
return null; return null;
} }
[JsonIgnore]
public override bool SupportsPeople => false;
public static string GetPath(string name) public static string GetPath(string name)
{ {
return GetPath(name, true); return GetPath(name, true);

View file

@ -1,4 +1,4 @@
#pragma warning disable CA1002, CS1591 #pragma warning disable CA1002, CA1819, CS1591
using System.Collections.Generic; using System.Collections.Generic;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;