From 785deff188ba51243739b827dbe42b5645404367 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Apr 2013 14:02:30 -0400 Subject: removed excess hashing in providers and made user data key-based --- .../Sorting/DatePlayedComparer.cs | 9 ++++++++- MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Sorting') diff --git a/MediaBrowser.Server.Implementations/Sorting/DatePlayedComparer.cs b/MediaBrowser.Server.Implementations/Sorting/DatePlayedComparer.cs index 905d5413a..c634c760e 100644 --- a/MediaBrowser.Server.Implementations/Sorting/DatePlayedComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/DatePlayedComparer.cs @@ -1,5 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Querying; using System; @@ -23,6 +24,12 @@ namespace MediaBrowser.Server.Implementations.Sorting /// The user manager. public IUserManager UserManager { get; set; } + /// + /// Gets or sets the user data repository. + /// + /// The user data repository. + public IUserDataRepository UserDataRepository { get; set; } + /// /// Compares the specified x. /// @@ -41,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.Sorting /// DateTime. private DateTime GetDate(BaseItem x) { - var userdata = UserManager.GetUserData(User.Id, x.UserDataId).Result; + var userdata = UserDataRepository.GetUserData(User.Id, x.GetUserDataKey()).Result; if (userdata != null && userdata.LastPlayedDate.HasValue) { diff --git a/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs b/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs index 82e76e78d..a7cbd2149 100644 --- a/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/PlayCountComparer.cs @@ -1,5 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Querying; @@ -34,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.Sorting /// DateTime. private int GetValue(BaseItem x) { - var userdata = UserManager.GetUserData(User.Id, x.UserDataId).Result; + var userdata = UserDataRepository.GetUserData(User.Id, x.GetUserDataKey()).Result; return userdata == null ? 0 : userdata.PlayCount; } @@ -48,6 +49,12 @@ namespace MediaBrowser.Server.Implementations.Sorting get { return ItemSortBy.PlayCount; } } + /// + /// Gets or sets the user data repository. + /// + /// The user data repository. + public IUserDataRepository UserDataRepository { get; set; } + /// /// Gets or sets the user manager. /// -- cgit v1.2.3