mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
add custom collection sort orders to edit page
This commit is contained in:
parent
ede84702d1
commit
ecc6fcfbab
@ -318,6 +318,12 @@ namespace MediaBrowser.Api
|
|||||||
hasLang.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode;
|
hasLang.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode;
|
||||||
hasLang.PreferredMetadataLanguage = request.PreferredMetadataLanguage;
|
hasLang.PreferredMetadataLanguage = request.PreferredMetadataLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasDisplayOrder = item as IHasDisplayOrder;
|
||||||
|
if (hasDisplayOrder != null)
|
||||||
|
{
|
||||||
|
hasDisplayOrder.DisplayOrder = request.DisplayOrder;
|
||||||
|
}
|
||||||
|
|
||||||
var hasAspectRatio = item as IHasAspectRatio;
|
var hasAspectRatio = item as IHasAspectRatio;
|
||||||
if (hasAspectRatio != null)
|
if (hasAspectRatio != null)
|
||||||
|
15
MediaBrowser.Controller/Entities/IHasDisplayOrder.cs
Normal file
15
MediaBrowser.Controller/Entities/IHasDisplayOrder.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IHasDisplayOrder
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasDisplayOrder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display order.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The display order.</value>
|
||||||
|
string DisplayOrder { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class BoxSet
|
/// Class BoxSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage
|
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder
|
||||||
{
|
{
|
||||||
public BoxSet()
|
public BoxSet()
|
||||||
{
|
{
|
||||||
@ -40,6 +40,12 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
/// <value>The preferred metadata country code.</value>
|
/// <value>The preferred metadata country code.</value>
|
||||||
public string PreferredMetadataCountryCode { get; set; }
|
public string PreferredMetadataCountryCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display order.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The display order.</value>
|
||||||
|
public string DisplayOrder { get; set; }
|
||||||
|
|
||||||
protected override bool GetBlockUnratedValue(UserConfiguration config)
|
protected override bool GetBlockUnratedValue(UserConfiguration config)
|
||||||
{
|
{
|
||||||
return config.BlockUnratedMovies;
|
return config.BlockUnratedMovies;
|
||||||
@ -49,6 +55,19 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
{
|
{
|
||||||
var children = base.GetChildren(user, 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);
|
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Series
|
/// Class Series
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage
|
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder
|
||||||
{
|
{
|
||||||
public List<Guid> SpecialFeatureIds { get; set; }
|
public List<Guid> SpecialFeatureIds { get; set; }
|
||||||
public List<Guid> SoundtrackIds { get; set; }
|
public List<Guid> SoundtrackIds { get; set; }
|
||||||
@ -45,6 +45,8 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
|
|
||||||
public List<MediaUrl> RemoteTrailers { get; set; }
|
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||||
|
|
||||||
|
public string DisplayOrder { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the tags.
|
/// Gets or sets the tags.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -238,7 +238,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(parentPath))
|
if (string.IsNullOrEmpty(parentPath))
|
||||||
{
|
{
|
||||||
throw new ApplicationException("Unable to get parent path info from " + path);
|
throw new IOException("Unable to get parent path info from " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
files = new DirectoryInfo(parentPath)
|
files = new DirectoryInfo(parentPath)
|
||||||
@ -247,7 +247,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
files = ResolveArgs.FileSystemChildren.Where(i =>
|
var resolveArgs = ResolveArgs;
|
||||||
|
|
||||||
|
if (resolveArgs == null)
|
||||||
|
{
|
||||||
|
throw new IOException("ResolveArgs are null for " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
files = resolveArgs.FileSystemChildren.Where(i =>
|
||||||
{
|
{
|
||||||
if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
<Compile Include="Entities\IHasAspectRatio.cs" />
|
<Compile Include="Entities\IHasAspectRatio.cs" />
|
||||||
<Compile Include="Entities\IHasBudget.cs" />
|
<Compile Include="Entities\IHasBudget.cs" />
|
||||||
<Compile Include="Entities\IHasCriticRating.cs" />
|
<Compile Include="Entities\IHasCriticRating.cs" />
|
||||||
|
<Compile Include="Entities\IHasDisplayOrder.cs" />
|
||||||
<Compile Include="Entities\IHasImages.cs" />
|
<Compile Include="Entities\IHasImages.cs" />
|
||||||
<Compile Include="Entities\IHasMediaStreams.cs" />
|
<Compile Include="Entities\IHasMediaStreams.cs" />
|
||||||
<Compile Include="Entities\IHasPreferredMetadataLanguage.cs" />
|
<Compile Include="Entities\IHasPreferredMetadataLanguage.cs" />
|
||||||
|
@ -532,6 +532,21 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "DisplayOrder":
|
||||||
|
{
|
||||||
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
|
var hasDisplayOrder = item as IHasDisplayOrder;
|
||||||
|
if (hasDisplayOrder != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
hasDisplayOrder.DisplayOrder = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "Trailers":
|
case "Trailers":
|
||||||
{
|
{
|
||||||
using (var subtree = reader.ReadSubtree())
|
using (var subtree = reader.ReadSubtree())
|
||||||
|
@ -392,6 +392,12 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// <value>The album.</value>
|
/// <value>The album.</value>
|
||||||
public string Album { get; set; }
|
public string Album { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display order.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The display order.</value>
|
||||||
|
public string DisplayOrder { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the album id.
|
/// Gets or sets the album id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,7 +60,11 @@ namespace MediaBrowser.Providers.ImagesByName
|
|||||||
|
|
||||||
private static string GetComparableName(string name)
|
private static string GetComparableName(string name)
|
||||||
{
|
{
|
||||||
return name.Replace(" ", string.Empty).Replace(".", string.Empty).Replace("&", string.Empty).Replace("!", string.Empty);
|
return name.Replace(" ", string.Empty)
|
||||||
|
.Replace(".", string.Empty)
|
||||||
|
.Replace("&", string.Empty)
|
||||||
|
.Replace("!", string.Empty)
|
||||||
|
.Replace(",", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<string> GetAvailableImages(string file)
|
public static IEnumerable<string> GetAvailableImages(string file)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Providers.Movies;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -31,6 +31,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
"CriticRating",
|
"CriticRating",
|
||||||
"CriticRatingSummary",
|
"CriticRatingSummary",
|
||||||
"DeathDate",
|
"DeathDate",
|
||||||
|
"DisplayOrder",
|
||||||
"EndDate",
|
"EndDate",
|
||||||
"Genres",
|
"Genres",
|
||||||
"Genre",
|
"Genre",
|
||||||
@ -284,6 +285,12 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasDisplayOrder = item as IHasDisplayOrder;
|
||||||
|
if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
|
||||||
|
{
|
||||||
|
builder.Append("<DisplayOrder>" + SecurityElement.Escape(hasDisplayOrder.DisplayOrder) + "</DisplayOrder>");
|
||||||
|
}
|
||||||
|
|
||||||
var hasBudget = item as IHasBudget;
|
var hasBudget = item as IHasBudget;
|
||||||
if (hasBudget != null)
|
if (hasBudget != null)
|
||||||
{
|
{
|
||||||
|
@ -764,6 +764,12 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
dto.LocalTrailerCount = hasTrailers.LocalTrailerIds.Count;
|
dto.LocalTrailerCount = hasTrailers.LocalTrailerIds.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasDisplayOrder = item as IHasDisplayOrder;
|
||||||
|
if (hasDisplayOrder != null)
|
||||||
|
{
|
||||||
|
dto.DisplayOrder = hasDisplayOrder.DisplayOrder;
|
||||||
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.RemoteTrailers))
|
if (fields.Contains(ItemFields.RemoteTrailers))
|
||||||
{
|
{
|
||||||
dto.RemoteTrailers = hasTrailers != null ?
|
dto.RemoteTrailers = hasTrailers != null ?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user