using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities.Movies
{
///
/// Class BoxSet
///
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder
{
public BoxSet()
{
RemoteTrailers = new List();
LocalTrailerIds = new List();
Tags = new List();
}
public List LocalTrailerIds { get; set; }
///
/// Gets or sets the remote trailers.
///
/// The remote trailers.
public List RemoteTrailers { get; set; }
///
/// Gets or sets the tags.
///
/// The tags.
public List Tags { get; set; }
public string PreferredMetadataLanguage { get; set; }
///
/// Gets or sets the preferred metadata country code.
///
/// The preferred metadata country code.
public string PreferredMetadataCountryCode { get; set; }
///
/// Gets or sets the display order.
///
/// The display order.
public string DisplayOrder { get; set; }
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
}
public override IEnumerable GetChildren(User user, bool includeLinkedChildren)
{
var children = base.GetChildren(user, includeLinkedChildren);
if (string.Equals(DisplayOrder, "SortName", StringComparison.OrdinalIgnoreCase))
{
// Sort by name
return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending);
}
if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
{
// Sort by release date
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
}
// Default sorting
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
}
}
}