From 6c7175e33d258ff2e65735f68cb05f110a8d2306 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Mon, 23 Jul 2012 11:05:30 -0400 Subject: Added an api call to pull down user configuration --- .../Configuration/ServerConfiguration.cs | 26 ++++++++++++++++++--- .../Configuration/ServerConfigurationController.cs | 27 ++++++++++++++++++++++ MediaBrowser.Controller/Kernel.cs | 7 ++++-- .../MediaBrowser.Controller.csproj | 1 + 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 MediaBrowser.Controller/Configuration/ServerConfigurationController.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Configuration/ServerConfiguration.cs b/MediaBrowser.Controller/Configuration/ServerConfiguration.cs index 38b1b9caf..73727b393 100644 --- a/MediaBrowser.Controller/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Controller/Configuration/ServerConfiguration.cs @@ -1,16 +1,36 @@ -using MediaBrowser.Common.Configuration; +using System.Collections.Generic; +using MediaBrowser.Common.Configuration; namespace MediaBrowser.Controller.Configuration { public class ServerConfiguration : BaseConfiguration { public string ImagesByNamePath { get; set; } - public int RecentItemDays { get; set; } + + /// + /// Gets or sets the default UI configuration + /// + public UserConfiguration DefaultUserConfiguration { get; set; } + + /// + /// Gets or sets a list of registered UI device names + /// + public List DeviceNames { get; set; } + + /// + /// Gets or sets all available UIConfigurations + /// The key contains device name and user id + /// + public Dictionary UserConfigurations { get; set; } public ServerConfiguration() : base() { - RecentItemDays = 14; + DefaultUserConfiguration = new UserConfiguration(); + + UserConfigurations = new Dictionary(); + + DeviceNames = new List(); } } } diff --git a/MediaBrowser.Controller/Configuration/ServerConfigurationController.cs b/MediaBrowser.Controller/Configuration/ServerConfigurationController.cs new file mode 100644 index 000000000..6f262a32e --- /dev/null +++ b/MediaBrowser.Controller/Configuration/ServerConfigurationController.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MediaBrowser.Common.Configuration; + +namespace MediaBrowser.Controller.Configuration +{ + /// + /// Extends BaseConfigurationController by adding methods to get and set UIConfiguration data + /// + public class ServerConfigurationController : ConfigurationController + { + private string GetDictionaryKey(Guid userId, string deviceName) + { + string guidString = userId == Guid.Empty ? string.Empty : userId.ToString(); + + return deviceName + "-" + guidString; + } + + public UserConfiguration GetUserConfiguration(Guid userId) + { + return Configuration.DefaultUserConfiguration; + } + } +} diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 0a5034859..468e7ab2f 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Kernel; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Events; @@ -16,7 +17,7 @@ using MediaBrowser.Model.Users; namespace MediaBrowser.Controller { - public class Kernel : BaseKernel + public class Kernel : BaseKernel { public static Kernel Instance { get; private set; } @@ -249,7 +250,9 @@ namespace MediaBrowser.Controller { DateTime now = DateTime.Now; - return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < Configuration.RecentItemDays); + UserConfiguration config = ConfigurationController.GetUserConfiguration(userId); + + return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < config.RecentItemDays); } /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 92a7e8107..296c44d1a 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -43,6 +43,7 @@ + -- cgit v1.2.3