diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-03 10:33:40 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-03 10:33:40 -0400 |
| commit | 2e43a0746c37396946330107bdb158e80bc4f22b (patch) | |
| tree | 16848e83ec4d7b39b433411b4c566e89c08bdb33 | |
| parent | 35f755cce38b892293233556bf748c57f38a2170 (diff) | |
fixes #508 - Add more sort orders to web client album page
| -rw-r--r-- | MediaBrowser.Server.Implementations/Sorting/AlbumArtistComparer.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Sorting/AlbumArtistComparer.cs b/MediaBrowser.Server.Implementations/Sorting/AlbumArtistComparer.cs index 2493c0fc6..583280f0f 100644 --- a/MediaBrowser.Server.Implementations/Sorting/AlbumArtistComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/AlbumArtistComparer.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using System.Linq; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Querying; @@ -31,7 +32,26 @@ namespace MediaBrowser.Server.Implementations.Sorting { var audio = x as Audio; - return audio == null ? string.Empty : audio.AlbumArtist; + 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; } /// <summary> |
