From d49494476770b3c0a091841bd3bbd44862fb8137 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 9 Mar 2014 18:14:44 -0400 Subject: calculate item by name counts on the fly --- .../Sorting/SongCountComparer.cs | 71 ---------------------- 1 file changed, 71 deletions(-) delete mode 100644 MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs (limited to 'MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs') diff --git a/MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs deleted file mode 100644 index 85b849a21..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs +++ /dev/null @@ -1,71 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Querying; - -namespace MediaBrowser.Server.Implementations.Sorting -{ - class SongCountComparer : IUserBaseItemComparer - { - /// - /// Gets or sets the user. - /// - /// The user. - public User User { get; set; } - - /// - /// Gets or sets the user manager. - /// - /// The user manager. - public IUserManager UserManager { get; set; } - - /// - /// Gets or sets the user data repository. - /// - /// The user data repository. - public IUserDataManager UserDataRepository { get; set; } - - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - /// - /// Gets the date. - /// - /// The x. - /// DateTime. - private int GetValue(BaseItem x) - { - var itemByName = x as IItemByName; - - if (itemByName != null) - { - var counts = itemByName.GetItemByNameCounts(User.Id); - - if (counts != null) - { - return counts.SongCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.SongCount; } - } - } -} -- cgit v1.2.3