Convert ItemSortBy to enum (#9765)
* Convert ItemSortBy to enum * Rename Unknown to Default
This commit is contained in:
parent
21878577be
commit
c7a94d48ae
|
@ -917,7 +917,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private QueryResult<ServerItem> GetGenres(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetGenres(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
// Don't sort
|
// Don't sort
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
query.AncestorIds = new[] { parent.Id };
|
query.AncestorIds = new[] { parent.Id };
|
||||||
var genresResult = _libraryManager.GetGenres(query);
|
var genresResult = _libraryManager.GetGenres(query);
|
||||||
|
|
||||||
|
@ -933,7 +933,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private QueryResult<ServerItem> GetMusicGenres(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetMusicGenres(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
// Don't sort
|
// Don't sort
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
query.AncestorIds = new[] { parent.Id };
|
query.AncestorIds = new[] { parent.Id };
|
||||||
var genresResult = _libraryManager.GetMusicGenres(query);
|
var genresResult = _libraryManager.GetMusicGenres(query);
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private QueryResult<ServerItem> GetMusicAlbumArtists(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetMusicAlbumArtists(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
// Don't sort
|
// Don't sort
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
query.AncestorIds = new[] { parent.Id };
|
query.AncestorIds = new[] { parent.Id };
|
||||||
var artists = _libraryManager.GetAlbumArtists(query);
|
var artists = _libraryManager.GetAlbumArtists(query);
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private QueryResult<ServerItem> GetMusicArtists(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetMusicArtists(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
// Don't sort
|
// Don't sort
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
query.AncestorIds = new[] { parent.Id };
|
query.AncestorIds = new[] { parent.Id };
|
||||||
var artists = _libraryManager.GetArtists(query);
|
var artists = _libraryManager.GetArtists(query);
|
||||||
return ToResult(query.StartIndex, artists);
|
return ToResult(query.StartIndex, artists);
|
||||||
|
@ -980,7 +980,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
private QueryResult<ServerItem> GetFavoriteArtists(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetFavoriteArtists(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
// Don't sort
|
// Don't sort
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
query.AncestorIds = new[] { parent.Id };
|
query.AncestorIds = new[] { parent.Id };
|
||||||
query.IsFavorite = true;
|
query.IsFavorite = true;
|
||||||
var artists = _libraryManager.GetArtists(query);
|
var artists = _libraryManager.GetArtists(query);
|
||||||
|
@ -1011,7 +1011,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
||||||
private QueryResult<ServerItem> GetNextUp(BaseItem parent, InternalItemsQuery query)
|
private QueryResult<ServerItem> GetNextUp(BaseItem parent, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
|
|
||||||
var result = _tvSeriesManager.GetNextUp(
|
var result = _tvSeriesManager.GetNextUp(
|
||||||
new NextUpQuery
|
new NextUpQuery
|
||||||
|
@ -1036,7 +1036,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
||||||
private QueryResult<ServerItem> GetLatest(BaseItem parent, InternalItemsQuery query, BaseItemKind itemType)
|
private QueryResult<ServerItem> GetLatest(BaseItem parent, InternalItemsQuery query, BaseItemKind itemType)
|
||||||
{
|
{
|
||||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
query.OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
|
|
||||||
var items = _userViewManager.GetLatestItems(
|
var items = _userViewManager.GetLatestItems(
|
||||||
new LatestItemsQuery
|
new LatestItemsQuery
|
||||||
|
@ -1203,9 +1203,9 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sort">The <see cref="SortCriteria"/>.</param>
|
/// <param name="sort">The <see cref="SortCriteria"/>.</param>
|
||||||
/// <param name="isPreSorted">True if pre-sorted.</param>
|
/// <param name="isPreSorted">True if pre-sorted.</param>
|
||||||
private static (string SortName, SortOrder SortOrder)[] GetOrderBy(SortCriteria sort, bool isPreSorted)
|
private static (ItemSortBy SortName, SortOrder SortOrder)[] GetOrderBy(SortCriteria sort, bool isPreSorted)
|
||||||
{
|
{
|
||||||
return isPreSorted ? Array.Empty<(string, SortOrder)>() : new[] { (ItemSortBy.SortName, sort.SortOrder) };
|
return isPreSorted ? Array.Empty<(ItemSortBy, SortOrder)>() : new[] { (ItemSortBy.SortName, sort.SortOrder) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2042,7 +2042,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sortingFields = new HashSet<string>(query.OrderBy.Select(i => i.OrderBy), StringComparer.OrdinalIgnoreCase);
|
var sortingFields = new HashSet<ItemSortBy>(query.OrderBy.Select(i => i.OrderBy));
|
||||||
|
|
||||||
return sortingFields.Contains(ItemSortBy.IsFavoriteOrLiked)
|
return sortingFields.Contains(ItemSortBy.IsFavoriteOrLiked)
|
||||||
|| sortingFields.Contains(ItemSortBy.IsPlayed)
|
|| sortingFields.Contains(ItemSortBy.IsPlayed)
|
||||||
|
@ -2832,20 +2832,20 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
if (hasSimilar || hasSearch)
|
if (hasSimilar || hasSearch)
|
||||||
{
|
{
|
||||||
List<(string, SortOrder)> prepend = new List<(string, SortOrder)>(4);
|
List<(ItemSortBy, SortOrder)> prepend = new List<(ItemSortBy, SortOrder)>(4);
|
||||||
if (hasSearch)
|
if (hasSearch)
|
||||||
{
|
{
|
||||||
prepend.Add(("SearchScore", SortOrder.Descending));
|
prepend.Add((ItemSortBy.SearchScore, SortOrder.Descending));
|
||||||
prepend.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
prepend.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasSimilar)
|
if (hasSimilar)
|
||||||
{
|
{
|
||||||
prepend.Add(("SimilarityScore", SortOrder.Descending));
|
prepend.Add((ItemSortBy.SimilarityScore, SortOrder.Descending));
|
||||||
prepend.Add((ItemSortBy.Random, SortOrder.Ascending));
|
prepend.Add((ItemSortBy.Random, SortOrder.Ascending));
|
||||||
}
|
}
|
||||||
|
|
||||||
var arr = new (string, SortOrder)[prepend.Count + orderBy.Count];
|
var arr = new (ItemSortBy, SortOrder)[prepend.Count + orderBy.Count];
|
||||||
prepend.CopyTo(arr, 0);
|
prepend.CopyTo(arr, 0);
|
||||||
orderBy.CopyTo(arr, prepend.Count);
|
orderBy.CopyTo(arr, prepend.Count);
|
||||||
orderBy = query.OrderBy = arr;
|
orderBy = query.OrderBy = arr;
|
||||||
|
@ -2863,166 +2863,43 @@ namespace Emby.Server.Implementations.Data
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string MapOrderByField(string name, InternalItemsQuery query)
|
private string MapOrderByField(ItemSortBy sortBy, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (string.Equals(name, ItemSortBy.AirTime, StringComparison.OrdinalIgnoreCase))
|
return sortBy switch
|
||||||
{
|
{
|
||||||
// TODO
|
ItemSortBy.AirTime => "SortName", // TODO
|
||||||
return "SortName";
|
ItemSortBy.Runtime => "RuntimeTicks",
|
||||||
}
|
ItemSortBy.Random => "RANDOM()",
|
||||||
|
ItemSortBy.DatePlayed when query.GroupBySeriesPresentationUniqueKey => "MAX(LastPlayedDate)",
|
||||||
if (string.Equals(name, ItemSortBy.Runtime, StringComparison.OrdinalIgnoreCase))
|
ItemSortBy.DatePlayed => "LastPlayedDate",
|
||||||
{
|
ItemSortBy.PlayCount => "PlayCount",
|
||||||
return "RuntimeTicks";
|
ItemSortBy.IsFavoriteOrLiked => "(Select Case When IsFavorite is null Then 0 Else IsFavorite End )",
|
||||||
}
|
ItemSortBy.IsFolder => "IsFolder",
|
||||||
|
ItemSortBy.IsPlayed => "played",
|
||||||
if (string.Equals(name, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase))
|
ItemSortBy.IsUnplayed => "played",
|
||||||
{
|
ItemSortBy.DateLastContentAdded => "DateLastMediaAdded",
|
||||||
return "RANDOM()";
|
ItemSortBy.Artist => "(select CleanValue from ItemValues where ItemId=Guid and Type=0 LIMIT 1)",
|
||||||
}
|
ItemSortBy.AlbumArtist => "(select CleanValue from ItemValues where ItemId=Guid and Type=1 LIMIT 1)",
|
||||||
|
ItemSortBy.OfficialRating => "InheritedParentalRatingValue",
|
||||||
if (string.Equals(name, ItemSortBy.DatePlayed, StringComparison.OrdinalIgnoreCase))
|
ItemSortBy.Studio => "(select CleanValue from ItemValues where ItemId=Guid and Type=3 LIMIT 1)",
|
||||||
{
|
ItemSortBy.SeriesDatePlayed => "(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)",
|
||||||
if (query.GroupBySeriesPresentationUniqueKey)
|
ItemSortBy.SeriesSortName => "SeriesName",
|
||||||
{
|
ItemSortBy.AiredEpisodeOrder => "AiredEpisodeOrder",
|
||||||
return "MAX(LastPlayedDate)";
|
ItemSortBy.Album => "Album",
|
||||||
}
|
ItemSortBy.DateCreated => "DateCreated",
|
||||||
|
ItemSortBy.PremiereDate => "PremiereDate",
|
||||||
return "LastPlayedDate";
|
ItemSortBy.StartDate => "StartDate",
|
||||||
}
|
ItemSortBy.Name => "Name",
|
||||||
|
ItemSortBy.CommunityRating => "CommunityRating",
|
||||||
if (string.Equals(name, ItemSortBy.PlayCount, StringComparison.OrdinalIgnoreCase))
|
ItemSortBy.ProductionYear => "ProductionYear",
|
||||||
{
|
ItemSortBy.CriticRating => "CriticRating",
|
||||||
return ItemSortBy.PlayCount;
|
ItemSortBy.VideoBitRate => "VideoBitRate",
|
||||||
}
|
ItemSortBy.ParentIndexNumber => "ParentIndexNumber",
|
||||||
|
ItemSortBy.IndexNumber => "IndexNumber",
|
||||||
if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase))
|
ItemSortBy.SimilarityScore => "SimilarityScore",
|
||||||
{
|
ItemSortBy.SearchScore => "SearchScore",
|
||||||
return "(Select Case When IsFavorite is null Then 0 Else IsFavorite End )";
|
_ => "SortName"
|
||||||
}
|
};
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.IsFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.IsPlayed, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "played";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.IsUnplayed, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "played";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.DateLastContentAdded, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "DateLastMediaAdded";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.Artist, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "(select CleanValue from ItemValues where ItemId=Guid and Type=0 LIMIT 1)";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.AlbumArtist, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "(select CleanValue from ItemValues where ItemId=Guid and Type=1 LIMIT 1)";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.OfficialRating, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "InheritedParentalRatingValue";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.Studio, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "(select CleanValue from ItemValues where ItemId=Guid and Type=3 LIMIT 1)";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.SeriesDatePlayed, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.SeriesSortName, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "SeriesName";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.AiredEpisodeOrder, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.AiredEpisodeOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.Album, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.Album;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.DateCreated, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.DateCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.PremiereDate, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.PremiereDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.StartDate, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.StartDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.Name, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.CommunityRating, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.CommunityRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.ProductionYear, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.ProductionYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.CriticRating, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.CriticRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.VideoBitRate, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.VideoBitRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.ParentIndexNumber, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.ParentIndexNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.IndexNumber, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.IndexNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.SimilarityScore, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.SimilarityScore;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(name, ItemSortBy.SearchScore, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ItemSortBy.SearchScore;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unknown SortBy, just sort by the SortName.
|
|
||||||
return ItemSortBy.SortName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Guid> GetItemIdsList(InternalItemsQuery query)
|
public List<Guid> GetItemIdsList(InternalItemsQuery query)
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Images
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
DtoOptions = new DtoOptions(true),
|
DtoOptions = new DtoOptions(true),
|
||||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||||
OrderBy = new (string, SortOrder)[]
|
OrderBy = new (ItemSortBy, SortOrder)[]
|
||||||
{
|
{
|
||||||
(ItemSortBy.IsFolder, SortOrder.Ascending),
|
(ItemSortBy.IsFolder, SortOrder.Ascending),
|
||||||
(ItemSortBy.SortName, SortOrder.Ascending)
|
(ItemSortBy.SortName, SortOrder.Ascending)
|
||||||
|
|
|
@ -1678,7 +1678,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="sortBy">The sort by.</param>
|
/// <param name="sortBy">The sort by.</param>
|
||||||
/// <param name="sortOrder">The sort order.</param>
|
/// <param name="sortOrder">The sort order.</param>
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy, SortOrder sortOrder)
|
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ItemSortBy> sortBy, SortOrder sortOrder)
|
||||||
{
|
{
|
||||||
var isFirst = true;
|
var isFirst = true;
|
||||||
|
|
||||||
|
@ -1701,7 +1701,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
return orderedItems ?? items;
|
return orderedItems ?? items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(string OrderBy, SortOrder SortOrder)> orderBy)
|
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(ItemSortBy OrderBy, SortOrder SortOrder)> orderBy)
|
||||||
{
|
{
|
||||||
var isFirst = true;
|
var isFirst = true;
|
||||||
|
|
||||||
|
@ -1736,9 +1736,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>IBaseItemComparer.</returns>
|
/// <returns>IBaseItemComparer.</returns>
|
||||||
private IBaseItemComparer GetComparer(string name, User user)
|
private IBaseItemComparer GetComparer(ItemSortBy name, User user)
|
||||||
{
|
{
|
||||||
var comparer = Comparers.FirstOrDefault(c => string.Equals(name, c.Name, StringComparison.OrdinalIgnoreCase));
|
var comparer = Comparers.FirstOrDefault(c => name == c.Type);
|
||||||
|
|
||||||
// If it requires a user, create a new one, and assign the user
|
// If it requires a user, create a new one, and assign the user
|
||||||
if (comparer is IUserBaseItemComparer)
|
if (comparer is IUserBaseItemComparer)
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
orderBy.Insert(0, (ItemSortBy.IsFavoriteOrLiked, SortOrder.Descending));
|
orderBy.Insert(0, (ItemSortBy.IsFavoriteOrLiked, SortOrder.Descending));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!internalQuery.OrderBy.Any(i => string.Equals(i.OrderBy, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase)))
|
if (internalQuery.OrderBy.All(i => i.OrderBy != ItemSortBy.SortName))
|
||||||
{
|
{
|
||||||
orderBy.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
orderBy.Add((ItemSortBy.SortName, SortOrder.Ascending));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.AiredEpisodeOrder;
|
public ItemSortBy Type => ItemSortBy.AiredEpisodeOrder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -16,7 +17,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.AlbumArtist;
|
public ItemSortBy Type => ItemSortBy.AlbumArtist;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -15,7 +16,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.Album;
|
public ItemSortBy Type => ItemSortBy.Album;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -12,7 +13,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
public class ArtistComparer : IBaseItemComparer
|
public class ArtistComparer : IBaseItemComparer
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name => ItemSortBy.Artist;
|
public ItemSortBy Type => ItemSortBy.Artist;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Compare(BaseItem? x, BaseItem? y)
|
public int Compare(BaseItem? x, BaseItem? y)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -13,7 +14,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.CommunityRating;
|
public ItemSortBy Type => ItemSortBy.CommunityRating;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -13,7 +14,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.CriticRating;
|
public ItemSortBy Type => ItemSortBy.CriticRating;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.DateCreated;
|
public ItemSortBy Type => ItemSortBy.DateCreated;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -34,7 +35,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.DateLastContentAdded;
|
public ItemSortBy Type => ItemSortBy.DateLastContentAdded;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -36,7 +37,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.DatePlayed;
|
public ItemSortBy Type => ItemSortBy.DatePlayed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.IndexNumber;
|
public ItemSortBy Type => ItemSortBy.IndexNumber;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -21,7 +22,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.IsFavoriteOrLiked;
|
public ItemSortBy Type => ItemSortBy.IsFavoriteOrLiked;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user data repository.
|
/// Gets or sets the user data repository.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -12,7 +13,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.IsFolder;
|
public ItemSortBy Type => ItemSortBy.IsFolder;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -22,7 +23,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.IsUnplayed;
|
public ItemSortBy Type => ItemSortBy.IsUnplayed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user data repository.
|
/// Gets or sets the user data repository.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -22,7 +23,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.IsUnplayed;
|
public ItemSortBy Type => ItemSortBy.IsUnplayed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user data repository.
|
/// Gets or sets the user data repository.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.Name;
|
public ItemSortBy Type => ItemSortBy.Name;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
@ -21,7 +22,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.OfficialRating;
|
public ItemSortBy Type => ItemSortBy.OfficialRating;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.ParentIndexNumber;
|
public ItemSortBy Type => ItemSortBy.ParentIndexNumber;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -23,7 +24,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.PlayCount;
|
public ItemSortBy Type => ItemSortBy.PlayCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user data repository.
|
/// Gets or sets the user data repository.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.PremiereDate;
|
public ItemSortBy Type => ItemSortBy.PremiereDate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -13,7 +14,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.ProductionYear;
|
public ItemSortBy Type => ItemSortBy.ProductionYear;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.Random;
|
public ItemSortBy Type => ItemSortBy.Random;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.Runtime;
|
public ItemSortBy Type => ItemSortBy.Runtime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -13,7 +14,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.SeriesSortName;
|
public ItemSortBy Type => ItemSortBy.SeriesSortName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.SortName;
|
public ItemSortBy Type => ItemSortBy.SortName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.LiveTv;
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.StartDate;
|
public ItemSortBy Type => ItemSortBy.StartDate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
@ -14,7 +15,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name => ItemSortBy.Studio;
|
public ItemSortBy Type => ItemSortBy.Studio;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class ArtistsController : BaseJellyfinApiController
|
||||||
[FromQuery] string? nameStartsWithOrGreater,
|
[FromQuery] string? nameStartsWithOrGreater,
|
||||||
[FromQuery] string? nameStartsWith,
|
[FromQuery] string? nameStartsWith,
|
||||||
[FromQuery] string? nameLessThan,
|
[FromQuery] string? nameLessThan,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery] bool? enableImages = true,
|
[FromQuery] bool? enableImages = true,
|
||||||
[FromQuery] bool enableTotalRecordCount = true)
|
[FromQuery] bool enableTotalRecordCount = true)
|
||||||
|
@ -317,7 +317,7 @@ public class ArtistsController : BaseJellyfinApiController
|
||||||
[FromQuery] string? nameStartsWithOrGreater,
|
[FromQuery] string? nameStartsWithOrGreater,
|
||||||
[FromQuery] string? nameStartsWith,
|
[FromQuery] string? nameStartsWith,
|
||||||
[FromQuery] string? nameLessThan,
|
[FromQuery] string? nameLessThan,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery] bool? enableImages = true,
|
[FromQuery] bool? enableImages = true,
|
||||||
[FromQuery] bool enableTotalRecordCount = true)
|
[FromQuery] bool enableTotalRecordCount = true)
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class ChannelsController : BaseJellyfinApiController
|
||||||
[FromQuery] int? limit,
|
[FromQuery] int? limit,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields)
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields)
|
||||||
{
|
{
|
||||||
userId = RequestHelpers.GetUserId(User, userId);
|
userId = RequestHelpers.GetUserId(User, userId);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class GenresController : BaseJellyfinApiController
|
||||||
[FromQuery] string? nameStartsWithOrGreater,
|
[FromQuery] string? nameStartsWithOrGreater,
|
||||||
[FromQuery] string? nameStartsWith,
|
[FromQuery] string? nameStartsWith,
|
||||||
[FromQuery] string? nameLessThan,
|
[FromQuery] string? nameLessThan,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery] bool? enableImages = true,
|
[FromQuery] bool? enableImages = true,
|
||||||
[FromQuery] bool enableTotalRecordCount = true)
|
[FromQuery] bool enableTotalRecordCount = true)
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class ItemsController : BaseJellyfinApiController
|
||||||
[FromQuery] bool? isFavorite,
|
[FromQuery] bool? isFavorite,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery] bool? isPlayed,
|
[FromQuery] bool? isPlayed,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
||||||
|
@ -654,7 +654,7 @@ public class ItemsController : BaseJellyfinApiController
|
||||||
[FromQuery] bool? isFavorite,
|
[FromQuery] bool? isFavorite,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery] bool? isPlayed,
|
[FromQuery] bool? isPlayed,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class LiveTvController : BaseJellyfinApiController
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
|
||||||
[FromQuery] bool? enableUserData,
|
[FromQuery] bool? enableUserData,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery] SortOrder? sortOrder,
|
[FromQuery] SortOrder? sortOrder,
|
||||||
[FromQuery] bool enableFavoriteSorting = false,
|
[FromQuery] bool enableFavoriteSorting = false,
|
||||||
[FromQuery] bool addCurrentProgram = true)
|
[FromQuery] bool addCurrentProgram = true)
|
||||||
|
@ -547,7 +547,7 @@ public class LiveTvController : BaseJellyfinApiController
|
||||||
[FromQuery] bool? isSports,
|
[FromQuery] bool? isSports,
|
||||||
[FromQuery] int? startIndex,
|
[FromQuery] int? startIndex,
|
||||||
[FromQuery] int? limit,
|
[FromQuery] int? limit,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] genreIds,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] genreIds,
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class MusicGenresController : BaseJellyfinApiController
|
||||||
[FromQuery] string? nameStartsWithOrGreater,
|
[FromQuery] string? nameStartsWithOrGreater,
|
||||||
[FromQuery] string? nameStartsWith,
|
[FromQuery] string? nameStartsWith,
|
||||||
[FromQuery] string? nameLessThan,
|
[FromQuery] string? nameLessThan,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
|
||||||
[FromQuery] bool? enableImages = true,
|
[FromQuery] bool? enableImages = true,
|
||||||
[FromQuery] bool enableTotalRecordCount = true)
|
[FromQuery] bool enableTotalRecordCount = true)
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class TrailersController : BaseJellyfinApiController
|
||||||
[FromQuery] bool? isFavorite,
|
[FromQuery] bool? isFavorite,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] imageTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery] bool? isPlayed,
|
[FromQuery] bool? isPlayed,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
|
||||||
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
[FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class TvShowsController : BaseJellyfinApiController
|
||||||
[FromQuery] int? imageTypeLimit,
|
[FromQuery] int? imageTypeLimit,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
||||||
[FromQuery] bool? enableUserData,
|
[FromQuery] bool? enableUserData,
|
||||||
[FromQuery] string? sortBy)
|
[FromQuery] ItemSortBy? sortBy)
|
||||||
{
|
{
|
||||||
userId = RequestHelpers.GetUserId(User, userId);
|
userId = RequestHelpers.GetUserId(User, userId);
|
||||||
var user = userId.Value.Equals(default)
|
var user = userId.Value.Equals(default)
|
||||||
|
@ -289,7 +289,7 @@ public class TvShowsController : BaseJellyfinApiController
|
||||||
episodes = UserViewBuilder.FilterForAdjacency(episodes, adjacentTo.Value).ToList();
|
episodes = UserViewBuilder.FilterForAdjacency(episodes, adjacentTo.Value).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(sortBy, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase))
|
if (sortBy == ItemSortBy.Random)
|
||||||
{
|
{
|
||||||
episodes.Shuffle();
|
episodes.Shuffle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class YearsController : BaseJellyfinApiController
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] includeItemTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] includeItemTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] sortBy,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
|
||||||
[FromQuery] bool? enableUserData,
|
[FromQuery] bool? enableUserData,
|
||||||
[FromQuery] int? imageTypeLimit,
|
[FromQuery] int? imageTypeLimit,
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
|
||||||
|
|
|
@ -30,14 +30,14 @@ public static class RequestHelpers
|
||||||
/// <param name="sortBy">Sort By. Comma delimited string.</param>
|
/// <param name="sortBy">Sort By. Comma delimited string.</param>
|
||||||
/// <param name="requestedSortOrder">Sort Order. Comma delimited string.</param>
|
/// <param name="requestedSortOrder">Sort Order. Comma delimited string.</param>
|
||||||
/// <returns>Order By.</returns>
|
/// <returns>Order By.</returns>
|
||||||
public static (string, SortOrder)[] GetOrderBy(IReadOnlyList<string> sortBy, IReadOnlyList<SortOrder> requestedSortOrder)
|
public static (ItemSortBy, SortOrder)[] GetOrderBy(IReadOnlyList<ItemSortBy> sortBy, IReadOnlyList<SortOrder> requestedSortOrder)
|
||||||
{
|
{
|
||||||
if (sortBy.Count == 0)
|
if (sortBy.Count == 0)
|
||||||
{
|
{
|
||||||
return Array.Empty<(string, SortOrder)>();
|
return Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = new (string, SortOrder)[sortBy.Count];
|
var result = new (ItemSortBy, SortOrder)[sortBy.Count];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
// Add elements which have a SortOrder specified
|
// Add elements which have a SortOrder specified
|
||||||
for (; i < requestedSortOrder.Count; i++)
|
for (; i < requestedSortOrder.Count; i++)
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class GetProgramsDto
|
||||||
/// Optional.
|
/// Optional.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
||||||
public IReadOnlyList<string> SortBy { get; set; } = Array.Empty<string>();
|
public IReadOnlyList<ItemSortBy> SortBy { get; set; } = Array.Empty<ItemSortBy>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets sort Order - Ascending,Descending.
|
/// Gets or sets sort Order - Ascending,Descending.
|
||||||
|
|
167
Jellyfin.Data/Enums/ItemSortBy.cs
Normal file
167
Jellyfin.Data/Enums/ItemSortBy.cs
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
namespace Jellyfin.Data.Enums;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// These represent sort orders.
|
||||||
|
/// </summary>
|
||||||
|
public enum ItemSortBy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default sort order.
|
||||||
|
/// </summary>
|
||||||
|
Default = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The aired episode order.
|
||||||
|
/// </summary>
|
||||||
|
AiredEpisodeOrder = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The album.
|
||||||
|
/// </summary>
|
||||||
|
Album = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The album artist.
|
||||||
|
/// </summary>
|
||||||
|
AlbumArtist = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The artist.
|
||||||
|
/// </summary>
|
||||||
|
Artist = 4,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date created.
|
||||||
|
/// </summary>
|
||||||
|
DateCreated = 5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The official rating.
|
||||||
|
/// </summary>
|
||||||
|
OfficialRating = 6,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date played.
|
||||||
|
/// </summary>
|
||||||
|
DatePlayed = 7,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The premiere date.
|
||||||
|
/// </summary>
|
||||||
|
PremiereDate = 8,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The start date.
|
||||||
|
/// </summary>
|
||||||
|
StartDate = 9,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sort name.
|
||||||
|
/// </summary>
|
||||||
|
SortName = 10,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name.
|
||||||
|
/// </summary>
|
||||||
|
Name = 11,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The random.
|
||||||
|
/// </summary>
|
||||||
|
Random = 12,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The runtime.
|
||||||
|
/// </summary>
|
||||||
|
Runtime = 13,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The community rating.
|
||||||
|
/// </summary>
|
||||||
|
CommunityRating = 14,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The production year.
|
||||||
|
/// </summary>
|
||||||
|
ProductionYear = 15,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The play count.
|
||||||
|
/// </summary>
|
||||||
|
PlayCount = 16,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The critic rating.
|
||||||
|
/// </summary>
|
||||||
|
CriticRating = 17,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The IsFolder boolean.
|
||||||
|
/// </summary>
|
||||||
|
IsFolder = 18,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The IsUnplayed boolean.
|
||||||
|
/// </summary>
|
||||||
|
IsUnplayed = 19,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The IsPlayed boolean.
|
||||||
|
/// </summary>
|
||||||
|
IsPlayed = 20,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The series sort.
|
||||||
|
/// </summary>
|
||||||
|
SeriesSortName = 21,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The video bitrate.
|
||||||
|
/// </summary>
|
||||||
|
VideoBitRate = 22,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The air time.
|
||||||
|
/// </summary>
|
||||||
|
AirTime = 23,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The studio.
|
||||||
|
/// </summary>
|
||||||
|
Studio = 24,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The IsFavouriteOrLiked boolean.
|
||||||
|
/// </summary>
|
||||||
|
IsFavoriteOrLiked = 25,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last content added date.
|
||||||
|
/// </summary>
|
||||||
|
DateLastContentAdded = 26,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The series last played date.
|
||||||
|
/// </summary>
|
||||||
|
SeriesDatePlayed = 27,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parent index number.
|
||||||
|
/// </summary>
|
||||||
|
ParentIndexNumber = 28,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index number.
|
||||||
|
/// </summary>
|
||||||
|
IndexNumber = 29,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The similarity score.
|
||||||
|
/// </summary>
|
||||||
|
SimilarityScore = 30,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The search score.
|
||||||
|
/// </summary>
|
||||||
|
SearchScore = 31,
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
MediaTypes = Array.Empty<string>();
|
MediaTypes = Array.Empty<string>();
|
||||||
MinSimilarityScore = 20;
|
MinSimilarityScore = 20;
|
||||||
OfficialRatings = Array.Empty<string>();
|
OfficialRatings = Array.Empty<string>();
|
||||||
OrderBy = Array.Empty<(string, SortOrder)>();
|
OrderBy = Array.Empty<(ItemSortBy, SortOrder)>();
|
||||||
PersonIds = Array.Empty<Guid>();
|
PersonIds = Array.Empty<Guid>();
|
||||||
PersonTypes = Array.Empty<string>();
|
PersonTypes = Array.Empty<string>();
|
||||||
PresetViews = Array.Empty<string>();
|
PresetViews = Array.Empty<string>();
|
||||||
|
@ -284,7 +284,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
public bool? HasChapterImages { get; set; }
|
public bool? HasChapterImages { get; set; }
|
||||||
|
|
||||||
public IReadOnlyList<(string OrderBy, SortOrder SortOrder)> OrderBy { get; set; }
|
public IReadOnlyList<(ItemSortBy OrderBy, SortOrder SortOrder)> OrderBy { get; set; }
|
||||||
|
|
||||||
public DateTime? MinDateCreated { get; set; }
|
public DateTime? MinDateCreated { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
{
|
{
|
||||||
public BoxSet()
|
public BoxSet()
|
||||||
{
|
{
|
||||||
DisplayOrder = ItemSortBy.PremiereDate;
|
DisplayOrder = "PremiereDate";
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -116,13 +116,13 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
{
|
{
|
||||||
var children = base.GetChildren(user, includeLinkedChildren, query);
|
var children = base.GetChildren(user, includeLinkedChildren, query);
|
||||||
|
|
||||||
if (string.Equals(DisplayOrder, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(DisplayOrder, "SortName", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Sort by name
|
// Sort by name
|
||||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(DisplayOrder, ItemSortBy.PremiereDate, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Sort by release date
|
// Sort by release date
|
||||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||||
|
@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
{
|
{
|
||||||
var children = base.GetRecursiveChildren(user, query);
|
var children = base.GetRecursiveChildren(user, query);
|
||||||
|
|
||||||
if (string.Equals(DisplayOrder, ItemSortBy.PremiereDate, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Sort by release date
|
// Sort by release date
|
||||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||||
|
|
|
@ -199,9 +199,9 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <param name="sortBy">The sort by.</param>
|
/// <param name="sortBy">The sort by.</param>
|
||||||
/// <param name="sortOrder">The sort order.</param>
|
/// <param name="sortOrder">The sort order.</param>
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy, SortOrder sortOrder);
|
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<ItemSortBy> sortBy, SortOrder sortOrder);
|
||||||
|
|
||||||
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(string OrderBy, SortOrder SortOrder)> orderBy);
|
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<(ItemSortBy OrderBy, SortOrder SortOrder)> orderBy);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user root folder.
|
/// Gets the user root folder.
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Sorting
|
namespace MediaBrowser.Controller.Sorting
|
||||||
|
@ -9,9 +10,8 @@ namespace MediaBrowser.Controller.Sorting
|
||||||
public interface IBaseItemComparer : IComparer<BaseItem?>
|
public interface IBaseItemComparer : IComparer<BaseItem?>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the comparer type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
ItemSortBy Type { get; }
|
||||||
string Name { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
public LiveTvChannelQuery()
|
public LiveTvChannelQuery()
|
||||||
{
|
{
|
||||||
EnableUserData = true;
|
EnableUserData = true;
|
||||||
SortBy = Array.Empty<string>();
|
SortBy = Array.Empty<ItemSortBy>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -99,7 +99,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
|
|
||||||
public bool? IsSeries { get; set; }
|
public bool? IsSeries { get; set; }
|
||||||
|
|
||||||
public string[] SortBy { get; set; }
|
public ItemSortBy[] SortBy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the sort order to return results with.
|
/// Gets or sets the sort order to return results with.
|
||||||
|
|
|
@ -1,163 +0,0 @@
|
||||||
namespace MediaBrowser.Model.Querying
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// These represent sort orders that are known by the core.
|
|
||||||
/// </summary>
|
|
||||||
public static class ItemSortBy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The aired episode order.
|
|
||||||
/// </summary>
|
|
||||||
public const string AiredEpisodeOrder = "AiredEpisodeOrder";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The album.
|
|
||||||
/// </summary>
|
|
||||||
public const string Album = "Album";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The album artist.
|
|
||||||
/// </summary>
|
|
||||||
public const string AlbumArtist = "AlbumArtist";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The artist.
|
|
||||||
/// </summary>
|
|
||||||
public const string Artist = "Artist";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The date created.
|
|
||||||
/// </summary>
|
|
||||||
public const string DateCreated = "DateCreated";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The official rating.
|
|
||||||
/// </summary>
|
|
||||||
public const string OfficialRating = "OfficialRating";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The date played.
|
|
||||||
/// </summary>
|
|
||||||
public const string DatePlayed = "DatePlayed";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The premiere date.
|
|
||||||
/// </summary>
|
|
||||||
public const string PremiereDate = "PremiereDate";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The start date.
|
|
||||||
/// </summary>
|
|
||||||
public const string StartDate = "StartDate";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The sort name.
|
|
||||||
/// </summary>
|
|
||||||
public const string SortName = "SortName";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The name.
|
|
||||||
/// </summary>
|
|
||||||
public const string Name = "Name";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The random.
|
|
||||||
/// </summary>
|
|
||||||
public const string Random = "Random";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The runtime.
|
|
||||||
/// </summary>
|
|
||||||
public const string Runtime = "Runtime";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The community rating.
|
|
||||||
/// </summary>
|
|
||||||
public const string CommunityRating = "CommunityRating";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The production year.
|
|
||||||
/// </summary>
|
|
||||||
public const string ProductionYear = "ProductionYear";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The play count.
|
|
||||||
/// </summary>
|
|
||||||
public const string PlayCount = "PlayCount";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The critic rating.
|
|
||||||
/// </summary>
|
|
||||||
public const string CriticRating = "CriticRating";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The IsFolder boolean.
|
|
||||||
/// </summary>
|
|
||||||
public const string IsFolder = "IsFolder";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The IsUnplayed boolean.
|
|
||||||
/// </summary>
|
|
||||||
public const string IsUnplayed = "IsUnplayed";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The IsPlayed boolean.
|
|
||||||
/// </summary>
|
|
||||||
public const string IsPlayed = "IsPlayed";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The series sort.
|
|
||||||
/// </summary>
|
|
||||||
public const string SeriesSortName = "SeriesSortName";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The video bitrate.
|
|
||||||
/// </summary>
|
|
||||||
public const string VideoBitRate = "VideoBitRate";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The air time.
|
|
||||||
/// </summary>
|
|
||||||
public const string AirTime = "AirTime";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The studio.
|
|
||||||
/// </summary>
|
|
||||||
public const string Studio = "Studio";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The IsFavouriteOrLiked boolean.
|
|
||||||
/// </summary>
|
|
||||||
public const string IsFavoriteOrLiked = "IsFavoriteOrLiked";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The last content added date.
|
|
||||||
/// </summary>
|
|
||||||
public const string DateLastContentAdded = "DateLastContentAdded";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The series last played date.
|
|
||||||
/// </summary>
|
|
||||||
public const string SeriesDatePlayed = "SeriesDatePlayed";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The parent index number.
|
|
||||||
/// </summary>
|
|
||||||
public const string ParentIndexNumber = "ParentIndexNumber";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The index number.
|
|
||||||
/// </summary>
|
|
||||||
public const string IndexNumber = "IndexNumber";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The similarity score.
|
|
||||||
/// </summary>
|
|
||||||
public const string SimilarityScore = "SimilarityScore";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The search score.
|
|
||||||
/// </summary>
|
|
||||||
public const string SearchScore = "SearchScore";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Jellyfin.Api.Tests.Helpers
|
||||||
{
|
{
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(GetOrderBy_Success_TestData))]
|
[MemberData(nameof(GetOrderBy_Success_TestData))]
|
||||||
public static void GetOrderBy_Success(IReadOnlyList<string> sortBy, IReadOnlyList<SortOrder> requestedSortOrder, (string, SortOrder)[] expected)
|
public static void GetOrderBy_Success(IReadOnlyList<ItemSortBy> sortBy, IReadOnlyList<SortOrder> requestedSortOrder, (ItemSortBy, SortOrder)[] expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, RequestHelpers.GetOrderBy(sortBy, requestedSortOrder));
|
Assert.Equal(expected, RequestHelpers.GetOrderBy(sortBy, requestedSortOrder));
|
||||||
}
|
}
|
||||||
|
@ -95,42 +95,42 @@ namespace Jellyfin.Api.Tests.Helpers
|
||||||
Assert.Throws<SecurityException>(() => RequestHelpers.GetUserId(principal, requestUserId));
|
Assert.Throws<SecurityException>(() => RequestHelpers.GetUserId(principal, requestUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TheoryData<IReadOnlyList<string>, IReadOnlyList<SortOrder>, (string, SortOrder)[]> GetOrderBy_Success_TestData()
|
public static TheoryData<IReadOnlyList<ItemSortBy>, IReadOnlyList<SortOrder>, (ItemSortBy, SortOrder)[]> GetOrderBy_Success_TestData()
|
||||||
{
|
{
|
||||||
var data = new TheoryData<IReadOnlyList<string>, IReadOnlyList<SortOrder>, (string, SortOrder)[]>();
|
var data = new TheoryData<IReadOnlyList<ItemSortBy>, IReadOnlyList<SortOrder>, (ItemSortBy, SortOrder)[]>();
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
Array.Empty<string>(),
|
Array.Empty<ItemSortBy>(),
|
||||||
Array.Empty<SortOrder>(),
|
Array.Empty<SortOrder>(),
|
||||||
Array.Empty<(string, SortOrder)>());
|
Array.Empty<(ItemSortBy, SortOrder)>());
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
new string[]
|
new[]
|
||||||
{
|
{
|
||||||
"IsFavoriteOrLiked",
|
ItemSortBy.IsFavoriteOrLiked,
|
||||||
"Random"
|
ItemSortBy.Random
|
||||||
},
|
},
|
||||||
Array.Empty<SortOrder>(),
|
Array.Empty<SortOrder>(),
|
||||||
new (string, SortOrder)[]
|
new (ItemSortBy, SortOrder)[]
|
||||||
{
|
{
|
||||||
("IsFavoriteOrLiked", SortOrder.Ascending),
|
(ItemSortBy.IsFavoriteOrLiked, SortOrder.Ascending),
|
||||||
("Random", SortOrder.Ascending),
|
(ItemSortBy.Random, SortOrder.Ascending),
|
||||||
});
|
});
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
new string[]
|
new[]
|
||||||
{
|
{
|
||||||
"SortName",
|
ItemSortBy.SortName,
|
||||||
"ProductionYear"
|
ItemSortBy.ProductionYear
|
||||||
},
|
},
|
||||||
new SortOrder[]
|
new[]
|
||||||
{
|
{
|
||||||
SortOrder.Descending
|
SortOrder.Descending
|
||||||
},
|
},
|
||||||
new (string, SortOrder)[]
|
new (ItemSortBy, SortOrder)[]
|
||||||
{
|
{
|
||||||
("SortName", SortOrder.Descending),
|
(ItemSortBy.SortName, SortOrder.Descending),
|
||||||
("ProductionYear", SortOrder.Descending),
|
(ItemSortBy.ProductionYear, SortOrder.Descending),
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user