From 2ca4b7d03adfa3cc7c9c6a597a11762142d5b34b Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 00:43:06 -0500 Subject: Created IConfigurationManager --- .../Library/UserManager.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/UserManager.cs') diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 0490a9cf0..a3a24fb34 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Connectivity; @@ -89,15 +90,23 @@ namespace MediaBrowser.Server.Implementations.Library /// The kernel. private Kernel Kernel { get; set; } + /// + /// Gets or sets the configuration manager. + /// + /// The configuration manager. + private IServerConfigurationManager ConfigurationManager { get; set; } + /// /// Initializes a new instance of the class. /// /// The kernel. /// The logger. - public UserManager(Kernel kernel, ILogger logger) + /// The configuration manager. + public UserManager(Kernel kernel, ILogger logger, IServerConfigurationManager configurationManager) { _logger = logger; Kernel = kernel; + ConfigurationManager = configurationManager; } #region Events @@ -596,14 +605,14 @@ namespace MediaBrowser.Server.Implementations.Library var pctIn = Decimal.Divide(positionTicks, item.RunTimeTicks.Value) * 100; // Don't track in very beginning - if (pctIn < Kernel.Configuration.MinResumePct) + if (pctIn < ConfigurationManager.Configuration.MinResumePct) { positionTicks = 0; incrementPlayCount = false; } // If we're at the end, assume completed - else if (pctIn > Kernel.Configuration.MaxResumePct || positionTicks >= item.RunTimeTicks.Value) + else if (pctIn > ConfigurationManager.Configuration.MaxResumePct || positionTicks >= item.RunTimeTicks.Value) { positionTicks = 0; data.Played = true; @@ -614,7 +623,7 @@ namespace MediaBrowser.Server.Implementations.Library // Enforce MinResumeDuration var durationSeconds = TimeSpan.FromTicks(item.RunTimeTicks.Value).TotalSeconds; - if (durationSeconds < Kernel.Configuration.MinResumeDurationSeconds) + if (durationSeconds < ConfigurationManager.Configuration.MinResumeDurationSeconds) { positionTicks = 0; data.Played = true; -- cgit v1.2.3