mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
@@ -771,19 +771,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
[JsonIgnore]
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the parent.
|
||||
/// </summary>
|
||||
/// <value>The parent.</value>
|
||||
[JsonIgnore]
|
||||
public Folder Parent
|
||||
{
|
||||
get => GetParent() as Folder;
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParent(Folder parent)
|
||||
{
|
||||
ParentId = parent == null ? Guid.Empty : parent.Id;
|
||||
@@ -822,8 +809,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
foreach (var parent in GetParents())
|
||||
{
|
||||
var item = parent as T;
|
||||
if (item != null)
|
||||
if (parent is T item)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,25 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class UserView : Folder, IHasCollectionType
|
||||
{
|
||||
private static readonly string[] _viewTypesEligibleForGrouping = new string[]
|
||||
{
|
||||
Model.Entities.CollectionType.Movies,
|
||||
Model.Entities.CollectionType.TvShows,
|
||||
string.Empty
|
||||
};
|
||||
|
||||
private static readonly string[] _originalFolderViewTypes = new string[]
|
||||
{
|
||||
Model.Entities.CollectionType.Books,
|
||||
Model.Entities.CollectionType.MusicVideos,
|
||||
Model.Entities.CollectionType.HomeVideos,
|
||||
Model.Entities.CollectionType.Photos,
|
||||
Model.Entities.CollectionType.Music,
|
||||
Model.Entities.CollectionType.BoxSets
|
||||
};
|
||||
|
||||
public static ITVSeriesManager TVSeriesManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the view type.
|
||||
/// </summary>
|
||||
@@ -30,12 +49,22 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
public Guid? UserId { get; set; }
|
||||
|
||||
public static ITVSeriesManager TVSeriesManager;
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore]
|
||||
public string CollectionType => ViewType;
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore]
|
||||
public override bool SupportsInheritedParentImages => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPlayedStatus => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPeople => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<Guid> GetIdsForAncestorQuery()
|
||||
{
|
||||
@@ -53,17 +82,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsInheritedParentImages => false;
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPlayedStatus => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetChildCount(User user)
|
||||
{
|
||||
return GetChildren(user, true).Count;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||
{
|
||||
var parent = this as Folder;
|
||||
@@ -81,6 +106,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
.GetUserItems(parent, this, CollectionType, query);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
||||
{
|
||||
query ??= new InternalItemsQuery(user);
|
||||
@@ -91,16 +117,19 @@ namespace MediaBrowser.Controller.Entities
|
||||
return result.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanDelete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsSaveLocalMetadataEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
|
||||
{
|
||||
query.SetUser(user);
|
||||
@@ -111,32 +140,26 @@ namespace MediaBrowser.Controller.Entities
|
||||
return GetItemList(query);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
||||
{
|
||||
return GetChildren(user, false);
|
||||
}
|
||||
|
||||
private static readonly string[] UserSpecificViewTypes = new string[]
|
||||
{
|
||||
Model.Entities.CollectionType.Playlists
|
||||
};
|
||||
|
||||
public static bool IsUserSpecific(Folder folder)
|
||||
{
|
||||
var collectionFolder = folder as ICollectionFolder;
|
||||
|
||||
if (collectionFolder == null)
|
||||
if (folder is not ICollectionFolder collectionFolder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var supportsUserSpecific = folder as ISupportsUserSpecificView;
|
||||
if (supportsUserSpecific != null && supportsUserSpecific.EnableUserSpecificView)
|
||||
if (folder is ISupportsUserSpecificView supportsUserSpecific
|
||||
&& supportsUserSpecific.EnableUserSpecificView)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return UserSpecificViewTypes.Contains(collectionFolder.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
return string.Equals(Model.Entities.CollectionType.Playlists, collectionFolder.CollectionType, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public static bool IsEligibleForGrouping(Folder folder)
|
||||
@@ -145,39 +168,19 @@ namespace MediaBrowser.Controller.Entities
|
||||
&& IsEligibleForGrouping(collectionFolder.CollectionType);
|
||||
}
|
||||
|
||||
private static string[] ViewTypesEligibleForGrouping = new string[]
|
||||
{
|
||||
Model.Entities.CollectionType.Movies,
|
||||
Model.Entities.CollectionType.TvShows,
|
||||
string.Empty
|
||||
};
|
||||
|
||||
public static bool IsEligibleForGrouping(string viewType)
|
||||
{
|
||||
return ViewTypesEligibleForGrouping.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
return _viewTypesEligibleForGrouping.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static string[] OriginalFolderViewTypes = new string[]
|
||||
{
|
||||
Model.Entities.CollectionType.Books,
|
||||
Model.Entities.CollectionType.MusicVideos,
|
||||
Model.Entities.CollectionType.HomeVideos,
|
||||
Model.Entities.CollectionType.Photos,
|
||||
Model.Entities.CollectionType.Music,
|
||||
Model.Entities.CollectionType.BoxSets
|
||||
};
|
||||
|
||||
public static bool EnableOriginalFolder(string viewType)
|
||||
{
|
||||
return OriginalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
return _originalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService, System.Threading.CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsPeople => false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user