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/AlbumCountComparer.cs | 71 ---------------------- .../Sorting/EpisodeCountComparer.cs | 71 ---------------------- .../Sorting/MovieCountComparer.cs | 71 ---------------------- .../Sorting/MusicVideoCountComparer.cs | 71 ---------------------- .../Sorting/SeriesCountComparer.cs | 71 ---------------------- .../Sorting/SongCountComparer.cs | 71 ---------------------- .../Sorting/TrailerCountComparer.cs | 71 ---------------------- 7 files changed, 497 deletions(-) delete mode 100644 MediaBrowser.Server.Implementations/Sorting/AlbumCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/EpisodeCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/MovieCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/MusicVideoCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/SeriesCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/SongCountComparer.cs delete mode 100644 MediaBrowser.Server.Implementations/Sorting/TrailerCountComparer.cs (limited to 'MediaBrowser.Server.Implementations/Sorting') diff --git a/MediaBrowser.Server.Implementations/Sorting/AlbumCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/AlbumCountComparer.cs deleted file mode 100644 index e35ba00f2..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/AlbumCountComparer.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 AlbumCountComparer : 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.AlbumCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.AlbumCount; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sorting/EpisodeCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/EpisodeCountComparer.cs deleted file mode 100644 index b3fd8a023..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/EpisodeCountComparer.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 EpisodeCountComparer : 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.EpisodeCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.EpisodeCount; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sorting/MovieCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/MovieCountComparer.cs deleted file mode 100644 index 605f4d1af..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/MovieCountComparer.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 -{ - public class MovieCountComparer : 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.MovieCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.MovieCount; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sorting/MusicVideoCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/MusicVideoCountComparer.cs deleted file mode 100644 index 6c9c5534d..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/MusicVideoCountComparer.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 MusicVideoCountComparer : 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.MusicVideoCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.MusicVideoCount; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sorting/SeriesCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/SeriesCountComparer.cs deleted file mode 100644 index 8567e400c..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/SeriesCountComparer.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 SeriesCountComparer : 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.SeriesCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.SeriesCount; } - } - } -} 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; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/Sorting/TrailerCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/TrailerCountComparer.cs deleted file mode 100644 index a13875674..000000000 --- a/MediaBrowser.Server.Implementations/Sorting/TrailerCountComparer.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 -{ - public class TrailerCountComparer : 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.TrailerCount; - } - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.TrailerCount; } - } - } -} -- cgit v1.2.3