mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-17 15:46:22 +00:00
fixes #506 - Song list - make columns headers clickable for sorting
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
@@ -30,28 +29,9 @@ namespace MediaBrowser.Server.Implementations.Sorting
|
||||
/// <returns>System.String.</returns>
|
||||
private string GetValue(BaseItem x)
|
||||
{
|
||||
var audio = x as Audio;
|
||||
var audio = x as IHasAlbumArtist;
|
||||
|
||||
if (audio != null)
|
||||
{
|
||||
return audio.AlbumArtist;
|
||||
}
|
||||
|
||||
var album = x as MusicAlbum;
|
||||
|
||||
if (album != null)
|
||||
{
|
||||
var song = album.RecursiveChildren
|
||||
.OfType<Audio>()
|
||||
.FirstOrDefault(i => !string.IsNullOrEmpty(i.AlbumArtist));
|
||||
|
||||
if (song != null)
|
||||
{
|
||||
return song.AlbumArtist;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return audio != null ? audio.AlbumArtist : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
33
MediaBrowser.Server.Implementations/Sorting/NameComparer.cs
Normal file
33
MediaBrowser.Server.Implementations/Sorting/NameComparer.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Sorting
|
||||
{
|
||||
/// <summary>
|
||||
/// Class NameComparer
|
||||
/// </summary>
|
||||
public class NameComparer : IBaseItemComparer
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares the specified x.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
return string.Compare(x.Name, y.Name, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name
|
||||
{
|
||||
get { return ItemSortBy.Name; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user