Browse Source

Consolidated handlers that return lists of items. Renamed ApiBaseItemWrapper to ApiBaseItemContainer. Added Person and Studio DTO's to BaseItemWrapper

LukePulverenti Luke Pulverenti luke pulverenti 13 years ago
parent
commit
5c6ec34a9c

+ 41 - 3
MediaBrowser.Api/ApiService.cs

@@ -24,9 +24,9 @@ namespace MediaBrowser.Api
         /// <summary>
         /// <summary>
         /// Takes a BaseItem and returns the actual object that will be serialized by the api
         /// Takes a BaseItem and returns the actual object that will be serialized by the api
         /// </summary>
         /// </summary>
-        public static BaseItemWrapper<BaseItem> GetSerializationObject(BaseItem item, bool includeChildren, Guid userId)
+        public static BaseItemContainer<BaseItem> GetSerializationObject(BaseItem item, bool includeChildren, Guid userId)
         {
         {
-            BaseItemWrapper<BaseItem> wrapper = new BaseItemWrapper<BaseItem>()
+            BaseItemContainer<BaseItem> wrapper = new BaseItemContainer<BaseItem>()
             {
             {
                 Item = item,
                 Item = item,
                 UserItemData = Kernel.Instance.GetUserItemData(userId, item.Id),
                 UserItemData = Kernel.Instance.GetUserItemData(userId, item.Id),
@@ -60,7 +60,45 @@ namespace MediaBrowser.Api
                     wrapper.Children = Kernel.Instance.GetParentalAllowedChildren(folder, userId).Select(c => GetSerializationObject(c, false, userId));
                     wrapper.Children = Kernel.Instance.GetParentalAllowedChildren(folder, userId).Select(c => GetSerializationObject(c, false, userId));
                 }
                 }
 
 
-                wrapper.People = item.People;
+                // Attach People by transforming them into BaseItemPerson (DTO)
+                if (item.People != null)
+                {
+                    wrapper.People = item.People.Select(p =>
+                    {
+                        BaseItemPerson baseItemPerson = new BaseItemPerson();
+
+                        baseItemPerson.PersonInfo = p;
+
+                        Person ibnObject = Kernel.Instance.ItemController.GetPerson(p.Name);
+
+                        if (ibnObject != null)
+                        {
+                            baseItemPerson.PrimaryImagePath = ibnObject.PrimaryImagePath;
+                        }
+
+                        return baseItemPerson;
+                    });
+                }
+            }
+
+            // Attach Studios by transforming them into BaseItemStudio (DTO)
+            if (item.Studios != null)
+            {
+                wrapper.Studios = item.Studios.Select(s =>
+                {
+                    BaseItemStudio baseItemStudio = new BaseItemStudio();
+
+                    baseItemStudio.Name = s;
+
+                    Studio ibnObject = Kernel.Instance.ItemController.GetStudio(s);
+
+                    if (ibnObject != null)
+                    {
+                        baseItemStudio.PrimaryImagePath = ibnObject.PrimaryImagePath;
+                    }
+
+                    return baseItemStudio;
+                });
             }
             }
 
 
             return wrapper;
             return wrapper;

+ 2 - 2
MediaBrowser.Api/HttpHandlers/GenresHandler.cs

@@ -7,9 +7,9 @@ using MediaBrowser.Model.Entities;
 
 
 namespace MediaBrowser.Api.HttpHandlers
 namespace MediaBrowser.Api.HttpHandlers
 {
 {
-    public class GenresHandler : BaseJsonHandler<IEnumerable<CategoryInfo<Genre>>>
+    public class GenresHandler : BaseJsonHandler<IEnumerable<IBNItem<Genre>>>
     {
     {
-        protected override IEnumerable<CategoryInfo<Genre>> GetObjectToSerialize()
+        protected override IEnumerable<IBNItem<Genre>> GetObjectToSerialize()
         {
         {
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Guid userId = Guid.Parse(QueryString["userid"]);
             Guid userId = Guid.Parse(QueryString["userid"]);

+ 0 - 19
MediaBrowser.Api/HttpHandlers/InProgressItemsHandler.cs

@@ -1,19 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    class InProgressItemsHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                return Kernel.Instance.GetInProgressItems(parent, UserId);
-            }
-        }
-    }
-}

+ 2 - 2
MediaBrowser.Api/HttpHandlers/ItemHandler.cs

@@ -5,9 +5,9 @@ using MediaBrowser.Model.Entities;
 
 
 namespace MediaBrowser.Api.HttpHandlers
 namespace MediaBrowser.Api.HttpHandlers
 {
 {
-    public class ItemHandler : BaseJsonHandler<BaseItemWrapper<BaseItem>>
+    public class ItemHandler : BaseJsonHandler<BaseItemContainer<BaseItem>>
     {
     {
-        protected sealed override BaseItemWrapper<BaseItem> GetObjectToSerialize()
+        protected sealed override BaseItemContainer<BaseItem> GetObjectToSerialize()
         {
         {
             Guid userId = Guid.Parse(QueryString["userid"]);
             Guid userId = Guid.Parse(QueryString["userid"]);
 
 

+ 55 - 4
MediaBrowser.Api/HttpHandlers/ItemListHandler.cs

@@ -2,14 +2,15 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using MediaBrowser.Common.Net.Handlers;
 using MediaBrowser.Common.Net.Handlers;
+using MediaBrowser.Controller;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 
 
 namespace MediaBrowser.Api.HttpHandlers
 namespace MediaBrowser.Api.HttpHandlers
 {
 {
-    public abstract class ItemListHandler : BaseJsonHandler<IEnumerable<BaseItemWrapper<BaseItem>>>
+    public class ItemListHandler : BaseJsonHandler<IEnumerable<BaseItemContainer<BaseItem>>>
     {
     {
-        protected override IEnumerable<BaseItemWrapper<BaseItem>> GetObjectToSerialize()
+        protected override IEnumerable<BaseItemContainer<BaseItem>> GetObjectToSerialize()
         {
         {
             return ItemsToSerialize.Select(i =>
             return ItemsToSerialize.Select(i =>
             {
             {
@@ -18,9 +19,51 @@ namespace MediaBrowser.Api.HttpHandlers
             });
             });
         }
         }
 
 
-        protected abstract IEnumerable<BaseItem> ItemsToSerialize
+        protected IEnumerable<BaseItem> ItemsToSerialize
         {
         {
-            get;
+            get
+            {
+                Folder parent = ApiService.GetItemById(ItemId) as Folder;
+                
+                if (ListType.Equals("inprogressitems", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetInProgressItems(parent, UserId);
+                }
+                else if (ListType.Equals("recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetRecentlyAddedItems(parent, UserId);
+                }
+                else if (ListType.Equals("recentlyaddedunplayeditems", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetRecentlyAddedUnplayedItems(parent, UserId);
+                }
+                else if (ListType.Equals("itemswithgenre", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetItemsWithGenre(parent, QueryString["name"], UserId);
+                }
+                else if (ListType.Equals("itemswithyear", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetItemsWithYear(parent, int.Parse(QueryString["year"]), UserId);
+                }
+                else if (ListType.Equals("itemswithstudio", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetItemsWithStudio(parent, QueryString["name"], UserId);
+                }
+                else if (ListType.Equals("itemswithperson", StringComparison.OrdinalIgnoreCase))
+                {
+                    return Kernel.Instance.GetItemsWithPerson(parent, QueryString["name"], UserId);
+                }
+
+                throw new InvalidOperationException();
+            }
+        }
+
+        protected string ItemId
+        {
+            get
+            {
+                return QueryString["id"];
+            }
         }
         }
 
 
         protected Guid UserId
         protected Guid UserId
@@ -30,5 +73,13 @@ namespace MediaBrowser.Api.HttpHandlers
                 return Guid.Parse(QueryString["userid"]);
                 return Guid.Parse(QueryString["userid"]);
             }
             }
         }
         }
+        
+        private string ListType
+        {
+            get
+            {
+                return QueryString["listtype"] ?? string.Empty;
+            }
+        }
     }
     }
 }
 }

+ 0 - 22
MediaBrowser.Api/HttpHandlers/ItemsWithGenreHandler.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    /// <summary>
-    /// Gets all items within a Genre
-    /// </summary>
-    public class ItemsWithGenreHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                return Kernel.Instance.GetItemsWithGenre(parent, QueryString["name"], UserId);
-            }
-        }
-    }
-}

+ 0 - 32
MediaBrowser.Api/HttpHandlers/ItemsWithPersonHandler.cs

@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    /// <summary>
-    /// Gets all items within containing a person
-    /// </summary>
-    public class ItemsWithPersonHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                PersonType? personType = null;
-
-                string type = QueryString["persontype"];
-
-                if (!string.IsNullOrEmpty(type))
-                {
-                    personType = (PersonType)Enum.Parse(typeof(PersonType), type, true);
-                }
-
-                return Kernel.Instance.GetItemsWithPerson(parent, QueryString["name"], personType, UserId);
-            }
-        }
-    }
-}

+ 0 - 22
MediaBrowser.Api/HttpHandlers/ItemsWithStudioHandler.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    /// <summary>
-    /// Gets all items within containing a studio
-    /// </summary>
-    public class ItemsWithStudioHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                return Kernel.Instance.GetItemsWithStudio(parent, QueryString["name"], UserId);
-            }
-        }
-    }
-}

+ 0 - 22
MediaBrowser.Api/HttpHandlers/ItemsWithYearHandler.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    /// <summary>
-    /// Gets all items within containing a studio
-    /// </summary>
-    public class ItemsWithYearHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                return Kernel.Instance.GetItemsWithYear(parent, int.Parse(QueryString["name"]), UserId);
-            }
-        }
-    }
-}

+ 0 - 24
MediaBrowser.Api/HttpHandlers/RecentlyAddedItemsHandler.cs

@@ -1,24 +0,0 @@
-using System.Collections.Generic;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    class RecentlyAddedItemsHandler : ItemListHandler
-    {
-        protected override IEnumerable<BaseItem> ItemsToSerialize
-        {
-            get
-            {
-                Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
-
-                if (QueryString["unplayed"] == "1")
-                {
-                    return Kernel.Instance.GetRecentlyAddedUnplayedItems(parent, UserId);
-                }
-
-                return Kernel.Instance.GetRecentlyAddedItems(parent, UserId);
-            }
-        }
-    }
-}

+ 2 - 2
MediaBrowser.Api/HttpHandlers/StudiosHandler.cs

@@ -7,9 +7,9 @@ using MediaBrowser.Model.Entities;
 
 
 namespace MediaBrowser.Api.HttpHandlers
 namespace MediaBrowser.Api.HttpHandlers
 {
 {
-    public class StudiosHandler : BaseJsonHandler<IEnumerable<CategoryInfo<Studio>>>
+    public class StudiosHandler : BaseJsonHandler<IEnumerable<IBNItem<Studio>>>
     {
     {
-        protected override IEnumerable<CategoryInfo<Studio>> GetObjectToSerialize()
+        protected override IEnumerable<IBNItem<Studio>> GetObjectToSerialize()
         {
         {
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Guid userId = Guid.Parse(QueryString["userid"]);
             Guid userId = Guid.Parse(QueryString["userid"]);

+ 0 - 17
MediaBrowser.Api/HttpHandlers/UserConfigurationHandler.cs

@@ -1,17 +0,0 @@
-using System;
-using MediaBrowser.Common.Net.Handlers;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Configuration;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
-    public class UserConfigurationHandler : BaseJsonHandler<UserConfiguration>
-    {
-        protected override UserConfiguration GetObjectToSerialize()
-        {
-            Guid userId = Guid.Parse(QueryString["userid"]);
-
-            return Kernel.Instance.GetUserConfiguration(userId);
-        }
-    }
-}

+ 2 - 2
MediaBrowser.Api/HttpHandlers/YearsHandler.cs

@@ -7,9 +7,9 @@ using MediaBrowser.Model.Entities;
 
 
 namespace MediaBrowser.Api.HttpHandlers
 namespace MediaBrowser.Api.HttpHandlers
 {
 {
-    public class YearsHandler : BaseJsonHandler<IEnumerable<CategoryInfo<Year>>>
+    public class YearsHandler : BaseJsonHandler<IEnumerable<IBNItem<Year>>>
     {
     {
-        protected override IEnumerable<CategoryInfo<Year>> GetObjectToSerialize()
+        protected override IEnumerable<IBNItem<Year>> GetObjectToSerialize()
         {
         {
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
             Guid userId = Guid.Parse(QueryString["userid"]);
             Guid userId = Guid.Parse(QueryString["userid"]);

+ 0 - 7
MediaBrowser.Api/MediaBrowser.Api.csproj

@@ -49,23 +49,16 @@
     <Compile Include="ApiService.cs" />
     <Compile Include="ApiService.cs" />
     <Compile Include="HttpHandlers\AudioHandler.cs" />
     <Compile Include="HttpHandlers\AudioHandler.cs" />
     <Compile Include="HttpHandlers\BaseMediaHandler.cs" />
     <Compile Include="HttpHandlers\BaseMediaHandler.cs" />
-    <Compile Include="HttpHandlers\ItemsWithGenreHandler.cs" />
     <Compile Include="HttpHandlers\GenresHandler.cs" />
     <Compile Include="HttpHandlers\GenresHandler.cs" />
     <Compile Include="HttpHandlers\ImageHandler.cs" />
     <Compile Include="HttpHandlers\ImageHandler.cs" />
-    <Compile Include="HttpHandlers\InProgressItemsHandler.cs" />
     <Compile Include="HttpHandlers\ItemHandler.cs" />
     <Compile Include="HttpHandlers\ItemHandler.cs" />
     <Compile Include="HttpHandlers\ItemListHandler.cs" />
     <Compile Include="HttpHandlers\ItemListHandler.cs" />
-    <Compile Include="HttpHandlers\ItemsWithPersonHandler.cs" />
     <Compile Include="HttpHandlers\PersonHandler.cs" />
     <Compile Include="HttpHandlers\PersonHandler.cs" />
     <Compile Include="HttpHandlers\PluginConfigurationHandler.cs" />
     <Compile Include="HttpHandlers\PluginConfigurationHandler.cs" />
     <Compile Include="HttpHandlers\PluginsHandler.cs" />
     <Compile Include="HttpHandlers\PluginsHandler.cs" />
-    <Compile Include="HttpHandlers\RecentlyAddedItemsHandler.cs" />
-    <Compile Include="HttpHandlers\ItemsWithStudioHandler.cs" />
     <Compile Include="HttpHandlers\StudiosHandler.cs" />
     <Compile Include="HttpHandlers\StudiosHandler.cs" />
-    <Compile Include="HttpHandlers\UserConfigurationHandler.cs" />
     <Compile Include="HttpHandlers\UsersHandler.cs" />
     <Compile Include="HttpHandlers\UsersHandler.cs" />
     <Compile Include="HttpHandlers\VideoHandler.cs" />
     <Compile Include="HttpHandlers\VideoHandler.cs" />
-    <Compile Include="HttpHandlers\ItemsWithYearHandler.cs" />
     <Compile Include="HttpHandlers\YearsHandler.cs" />
     <Compile Include="HttpHandlers\YearsHandler.cs" />
     <Compile Include="ImageProcessor.cs" />
     <Compile Include="ImageProcessor.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Plugin.cs" />

+ 2 - 26
MediaBrowser.Api/Plugin.cs

@@ -49,46 +49,22 @@ namespace MediaBrowser.Api
             {
             {
                 return new UsersHandler();
                 return new UsersHandler();
             }
             }
-            else if (localPath.EndsWith("/api/itemswithgenre", StringComparison.OrdinalIgnoreCase))
+            else if (localPath.EndsWith("/api/itemlist", StringComparison.OrdinalIgnoreCase))
             {
             {
-                return new ItemsWithGenreHandler();
+                return new ItemListHandler();
             }
             }
             else if (localPath.EndsWith("/api/genres", StringComparison.OrdinalIgnoreCase))
             else if (localPath.EndsWith("/api/genres", StringComparison.OrdinalIgnoreCase))
             {
             {
                 return new GenresHandler();
                 return new GenresHandler();
             }
             }
-            else if (localPath.EndsWith("/api/itemswithyear", StringComparison.OrdinalIgnoreCase))
-            {
-                return new ItemsWithYearHandler();
-            }
-            else if (localPath.EndsWith("/api/itemswithperson", StringComparison.OrdinalIgnoreCase))
-            {
-                return new ItemsWithPersonHandler();
-            }
             else if (localPath.EndsWith("/api/years", StringComparison.OrdinalIgnoreCase))
             else if (localPath.EndsWith("/api/years", StringComparison.OrdinalIgnoreCase))
             {
             {
                 return new YearsHandler();
                 return new YearsHandler();
             }
             }
-            else if (localPath.EndsWith("/api/itemswithstudio", StringComparison.OrdinalIgnoreCase))
-            {
-                return new ItemsWithStudioHandler();
-            }
             else if (localPath.EndsWith("/api/studios", StringComparison.OrdinalIgnoreCase))
             else if (localPath.EndsWith("/api/studios", StringComparison.OrdinalIgnoreCase))
             {
             {
                 return new StudiosHandler();
                 return new StudiosHandler();
             }
             }
-            else if (localPath.EndsWith("/api/recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
-            {
-                return new RecentlyAddedItemsHandler();
-            }
-            else if (localPath.EndsWith("/api/inprogressitems", StringComparison.OrdinalIgnoreCase))
-            {
-                return new InProgressItemsHandler();
-            }
-            else if (localPath.EndsWith("/api/userconfiguration", StringComparison.OrdinalIgnoreCase))
-            {
-                return new UserConfigurationHandler();
-            }
             else if (localPath.EndsWith("/api/plugins", StringComparison.OrdinalIgnoreCase))
             else if (localPath.EndsWith("/api/plugins", StringComparison.OrdinalIgnoreCase))
             {
             {
                 return new PluginsHandler();
                 return new PluginsHandler();

+ 22 - 36
MediaBrowser.ApiInteraction/ApiClient.cs

@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Users;
 using MediaBrowser.Model.Users;
@@ -91,7 +90,7 @@ namespace MediaBrowser.ApiInteraction
         /// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
         /// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
         /// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
         /// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
         /// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
         /// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
-        public IEnumerable<string> GetBackdropImageUrls(BaseItemWrapper<ApiBaseItem> itemWrapper, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
+        public IEnumerable<string> GetBackdropImageUrls(ApiBaseItemContainer itemWrapper, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
         {
         {
             Guid? backdropItemId = null;
             Guid? backdropItemId = null;
             int backdropCount = 0;
             int backdropCount = 0;
@@ -131,7 +130,7 @@ namespace MediaBrowser.ApiInteraction
         /// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
         /// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
         /// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
         /// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
         /// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
         /// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
-        public string GetLogoImageUrl(BaseItemWrapper<ApiBaseItem> itemWrapper, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
+        public string GetLogoImageUrl(ApiBaseItemContainer itemWrapper, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
         {
         {
             Guid? logoItemId = !string.IsNullOrEmpty(itemWrapper.Item.LogoImagePath) ? itemWrapper.Item.Id : itemWrapper.ParentLogoItemId;
             Guid? logoItemId = !string.IsNullOrEmpty(itemWrapper.Item.LogoImagePath) ? itemWrapper.Item.Id : itemWrapper.ParentLogoItemId;
 
 
@@ -154,7 +153,7 @@ namespace MediaBrowser.ApiInteraction
         /// <summary>
         /// <summary>
         /// Gets a BaseItem
         /// Gets a BaseItem
         /// </summary>
         /// </summary>
-        public async Task<BaseItemWrapper<ApiBaseItem>> GetItemAsync(Guid id, Guid userId)
+        public async Task<ApiBaseItemContainer> GetItemAsync(Guid id, Guid userId)
         {
         {
             string url = ApiUrl + "/item?userId=" + userId.ToString();
             string url = ApiUrl + "/item?userId=" + userId.ToString();
 
 
@@ -165,7 +164,7 @@ namespace MediaBrowser.ApiInteraction
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<BaseItemWrapper<ApiBaseItem>>(stream);
+                return JsonSerializer.DeserializeFromStream<ApiBaseItemContainer>(stream);
             }
             }
         }
         }
 
 
@@ -185,61 +184,61 @@ namespace MediaBrowser.ApiInteraction
         /// <summary>
         /// <summary>
         /// Gets all Genres
         /// Gets all Genres
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<CategoryInfo<Genre>>> GetAllGenresAsync(Guid userId)
+        public async Task<IEnumerable<IBNItem<Genre>>> GetAllGenresAsync(Guid userId)
         {
         {
             string url = ApiUrl + "/genres?userId=" + userId.ToString();
             string url = ApiUrl + "/genres?userId=" + userId.ToString();
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Genre>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<IBNItem<Genre>>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all Years
         /// Gets all Years
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<CategoryInfo<Year>>> GetAllYearsAsync(Guid userId)
+        public async Task<IEnumerable<IBNItem<Year>>> GetAllYearsAsync(Guid userId)
         {
         {
             string url = ApiUrl + "/years?userId=" + userId.ToString();
             string url = ApiUrl + "/years?userId=" + userId.ToString();
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Year>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<IBNItem<Year>>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all items that contain a given Year
         /// Gets all items that contain a given Year
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<BaseItemWrapper<ApiBaseItem>>> GetItemsWithYearAsync(string name, Guid userId)
+        public async Task<IEnumerable<ApiBaseItemContainer>> GetItemsWithYearAsync(string name, Guid userId)
         {
         {
-            string url = ApiUrl + "/itemswithyear?userId=" + userId.ToString() + "&name=" + name;
+            string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<BaseItemWrapper<ApiBaseItem>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemContainer>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all items that contain a given Genre
         /// Gets all items that contain a given Genre
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<BaseItemWrapper<ApiBaseItem>>> GetItemsWithGenreAsync(string name, Guid userId)
+        public async Task<IEnumerable<ApiBaseItemContainer>> GetItemsWithGenreAsync(string name, Guid userId)
         {
         {
-            string url = ApiUrl + "/itemswithgenre?userId=" + userId.ToString() + "&name=" + name;
+            string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<BaseItemWrapper<ApiBaseItem>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemContainer>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all items that contain a given Person
         /// Gets all items that contain a given Person
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<BaseItemWrapper<ApiBaseItem>>> GetItemsWithPersonAsync(string name, PersonType? personType, Guid userId)
+        public async Task<IEnumerable<ApiBaseItemContainer>> GetItemsWithPersonAsync(string name, PersonType? personType, Guid userId)
         {
         {
-            string url = ApiUrl + "/itemswithperson?userId=" + userId.ToString() + "&name=" + name;
+            string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
 
 
             if (personType.HasValue)
             if (personType.HasValue)
             {
             {
@@ -248,46 +247,33 @@ namespace MediaBrowser.ApiInteraction
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<BaseItemWrapper<ApiBaseItem>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemContainer>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all studious
         /// Gets all studious
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<CategoryInfo<Studio>>> GetAllStudiosAsync(Guid userId)
+        public async Task<IEnumerable<IBNItem<Studio>>> GetAllStudiosAsync(Guid userId)
         {
         {
             string url = ApiUrl + "/studios?userId=" + userId.ToString();
             string url = ApiUrl + "/studios?userId=" + userId.ToString();
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<CategoryInfo<Studio>>>(stream);
-            }
-        }
-
-        /// <summary>
-        /// Gets the current personalized configuration
-        /// </summary>
-        public async Task<UserConfiguration> GetUserConfigurationAsync(Guid userId)
-        {
-            string url = ApiUrl + "/userconfiguration?userId=" + userId.ToString();
-
-            using (Stream stream = await HttpClient.GetStreamAsync(url))
-            {
-                return JsonSerializer.DeserializeFromStream<UserConfiguration>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<IBNItem<Studio>>>(stream);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
         /// Gets all items that contain a given Studio
         /// Gets all items that contain a given Studio
         /// </summary>
         /// </summary>
-        public async Task<IEnumerable<BaseItemWrapper<ApiBaseItem>>> GetItemsWithStudioAsync(string name, Guid userId)
+        public async Task<IEnumerable<ApiBaseItemContainer>> GetItemsWithStudioAsync(string name, Guid userId)
         {
         {
-            string url = ApiUrl + "/itemswithstudio?userId=" + userId.ToString() + "&name=" + name;
+            string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
 
 
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             using (Stream stream = await HttpClient.GetStreamAsync(url))
             {
             {
-                return JsonSerializer.DeserializeFromStream<IEnumerable<BaseItemWrapper<ApiBaseItem>>>(stream);
+                return JsonSerializer.DeserializeFromStream<IEnumerable<ApiBaseItemContainer>>(stream);
             }
             }
         }
         }
 
 

+ 0 - 27
MediaBrowser.Controller/Configuration/ServerConfiguration.cs

@@ -1,37 +1,10 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Configuration;
 
 
 namespace MediaBrowser.Controller.Configuration
 namespace MediaBrowser.Controller.Configuration
 {
 {
     public class ServerConfiguration : BaseApplicationConfiguration
     public class ServerConfiguration : BaseApplicationConfiguration
     {
     {
         public string ImagesByNamePath { get; set; }
         public string ImagesByNamePath { get; set; }
-
-        /// <summary>
-        /// Gets or sets the default UI configuration
-        /// </summary>
-        public UserConfiguration DefaultUserConfiguration { get; set; }
-
-        /// <summary>
-        /// Gets or sets a list of registered UI device names
-        /// </summary>
-        public List<string> DeviceNames { get; set; }
-
-        /// <summary>
-        /// Gets or sets all available UIConfigurations
-        /// The key contains device name and user id
-        /// </summary>
-        public Dictionary<string, UserConfiguration> UserConfigurations { get; set; }
-
-        public ServerConfiguration()
-            : base()
-        {
-            DefaultUserConfiguration = new UserConfiguration();
-
-            UserConfigurations = new Dictionary<string, UserConfiguration>();
-
-            DeviceNames = new List<string>();
-        }
     }
     }
 }
 }

+ 14 - 20
MediaBrowser.Controller/Kernel.cs

@@ -12,7 +12,6 @@ using MediaBrowser.Controller.Events;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Resolvers;
 using MediaBrowser.Controller.Resolvers;
-using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.DTO;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Progress;
 using MediaBrowser.Model.Progress;
@@ -155,11 +154,6 @@ namespace MediaBrowser.Controller
             }
             }
         }
         }
 
 
-        public UserConfiguration GetUserConfiguration(Guid userId)
-        {
-            return Configuration.DefaultUserConfiguration;
-        }
-
         public void ReloadItem(BaseItem item)
         public void ReloadItem(BaseItem item)
         {
         {
             Folder folder = item as Folder;
             Folder folder = item as Folder;
@@ -263,9 +257,9 @@ namespace MediaBrowser.Controller
         {
         {
             DateTime now = DateTime.Now;
             DateTime now = DateTime.Now;
 
 
-            UserConfiguration config = GetUserConfiguration(userId);
+            User user = Users.First(u => u.Id == userId);
 
 
-            return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < config.RecentItemDays);
+            return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < user.RecentItemDays);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -358,7 +352,7 @@ namespace MediaBrowser.Controller
         /// Gets all years from all recursive children of a folder
         /// Gets all years from all recursive children of a folder
         /// The CategoryInfo class is used to keep track of the number of times each year appears
         /// The CategoryInfo class is used to keep track of the number of times each year appears
         /// </summary>
         /// </summary>
-        public IEnumerable<CategoryInfo<Year>> GetAllYears(Folder parent, Guid userId)
+        public IEnumerable<IBNItem<Year>> GetAllYears(Folder parent, Guid userId)
         {
         {
             Dictionary<int, int> data = new Dictionary<int, int>();
             Dictionary<int, int> data = new Dictionary<int, int>();
 
 
@@ -385,7 +379,7 @@ namespace MediaBrowser.Controller
             }
             }
 
 
             // Now go through the dictionary and create a Category for each studio
             // Now go through the dictionary and create a Category for each studio
-            List<CategoryInfo<Year>> list = new List<CategoryInfo<Year>>();
+            List<IBNItem<Year>> list = new List<IBNItem<Year>>();
 
 
             foreach (int key in data.Keys)
             foreach (int key in data.Keys)
             {
             {
@@ -394,10 +388,10 @@ namespace MediaBrowser.Controller
 
 
                 if (entity != null)
                 if (entity != null)
                 {
                 {
-                    list.Add(new CategoryInfo<Year>()
+                    list.Add(new IBNItem<Year>()
                     {
                     {
                         Item = entity,
                         Item = entity,
-                        ItemCount = data[key]
+                        BaseItemCount = data[key]
                     });
                     });
                 }
                 }
             }
             }
@@ -409,7 +403,7 @@ namespace MediaBrowser.Controller
         /// Gets all studios from all recursive children of a folder
         /// Gets all studios from all recursive children of a folder
         /// The CategoryInfo class is used to keep track of the number of times each studio appears
         /// The CategoryInfo class is used to keep track of the number of times each studio appears
         /// </summary>
         /// </summary>
-        public IEnumerable<CategoryInfo<Studio>> GetAllStudios(Folder parent, Guid userId)
+        public IEnumerable<IBNItem<Studio>> GetAllStudios(Folder parent, Guid userId)
         {
         {
             Dictionary<string, int> data = new Dictionary<string, int>();
             Dictionary<string, int> data = new Dictionary<string, int>();
 
 
@@ -439,7 +433,7 @@ namespace MediaBrowser.Controller
             }
             }
 
 
             // Now go through the dictionary and create a Category for each studio
             // Now go through the dictionary and create a Category for each studio
-            List<CategoryInfo<Studio>> list = new List<CategoryInfo<Studio>>();
+            List<IBNItem<Studio>> list = new List<IBNItem<Studio>>();
 
 
             foreach (string key in data.Keys)
             foreach (string key in data.Keys)
             {
             {
@@ -448,10 +442,10 @@ namespace MediaBrowser.Controller
 
 
                 if (entity != null)
                 if (entity != null)
                 {
                 {
-                    list.Add(new CategoryInfo<Studio>()
+                    list.Add(new IBNItem<Studio>()
                     {
                     {
                         Item = entity,
                         Item = entity,
-                        ItemCount = data[key]
+                        BaseItemCount = data[key]
                     });
                     });
                 }
                 }
             }
             }
@@ -463,7 +457,7 @@ namespace MediaBrowser.Controller
         /// Gets all genres from all recursive children of a folder
         /// Gets all genres from all recursive children of a folder
         /// The CategoryInfo class is used to keep track of the number of times each genres appears
         /// The CategoryInfo class is used to keep track of the number of times each genres appears
         /// </summary>
         /// </summary>
-        public IEnumerable<CategoryInfo<Genre>> GetAllGenres(Folder parent, Guid userId)
+        public IEnumerable<IBNItem<Genre>> GetAllGenres(Folder parent, Guid userId)
         {
         {
             Dictionary<string, int> data = new Dictionary<string, int>();
             Dictionary<string, int> data = new Dictionary<string, int>();
 
 
@@ -493,7 +487,7 @@ namespace MediaBrowser.Controller
             }
             }
 
 
             // Now go through the dictionary and create a Category for each genre
             // Now go through the dictionary and create a Category for each genre
-            List<CategoryInfo<Genre>> list = new List<CategoryInfo<Genre>>();
+            List<IBNItem<Genre>> list = new List<IBNItem<Genre>>();
 
 
             foreach (string key in data.Keys)
             foreach (string key in data.Keys)
             {
             {
@@ -502,10 +496,10 @@ namespace MediaBrowser.Controller
 
 
                 if (entity != null)
                 if (entity != null)
                 {
                 {
-                    list.Add(new CategoryInfo<Genre>()
+                    list.Add(new IBNItem<Genre>()
                     {
                     {
                         Item = entity,
                         Item = entity,
-                        ItemCount = data[key]
+                        BaseItemCount = data[key]
                     });
                     });
                 }
                 }
             }
             }

+ 0 - 16
MediaBrowser.Model/Configuration/UserConfiguration.cs

@@ -1,16 +0,0 @@
-
-namespace MediaBrowser.Model.Configuration
-{
-    /// <summary>
-    /// This holds settings that can be personalized on a per-user, per-device basis.
-    /// </summary>
-    public class UserConfiguration
-    {
-        public int RecentItemDays { get; set; }
-
-        public UserConfiguration()
-        {
-            RecentItemDays = 14;
-        }
-    }
-}

+ 7 - 6
MediaBrowser.Model/DTO/ApiBaseItem.cs

@@ -20,14 +20,14 @@ namespace MediaBrowser.Model.DTO
     /// <summary>
     /// <summary>
     /// This is the full return object when requesting an Item
     /// This is the full return object when requesting an Item
     /// </summary>
     /// </summary>
-    public class BaseItemWrapper<T>
-        where T : BaseItem
+    public class BaseItemContainer<TItemType>
+        where TItemType : BaseItem
     {
     {
-        public T Item { get; set; }
+        public TItemType Item { get; set; }
 
 
         public UserItemData UserItemData { get; set; }
         public UserItemData UserItemData { get; set; }
 
 
-        public IEnumerable<BaseItemWrapper<T>> Children { get; set; }
+        public IEnumerable<BaseItemContainer<TItemType>> Children { get; set; }
 
 
         public bool IsFolder { get; set; }
         public bool IsFolder { get; set; }
 
 
@@ -45,7 +45,8 @@ namespace MediaBrowser.Model.DTO
             return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
             return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
         }
         }
 
 
-        public IEnumerable<PersonInfo> People { get; set; }
+        public IEnumerable<BaseItemPerson> People { get; set; }
+        public IEnumerable<BaseItemStudio> Studios { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// If the item does not have a logo, this will hold the Id of the Parent that has one.
         /// If the item does not have a logo, this will hold the Id of the Parent that has one.
@@ -60,7 +61,7 @@ namespace MediaBrowser.Model.DTO
     /// <summary>
     /// <summary>
     /// This is strictly for convenience so the UI's don't have to use the verbose generic syntax of BaseItemWrapper<ApiBaseItem>
     /// This is strictly for convenience so the UI's don't have to use the verbose generic syntax of BaseItemWrapper<ApiBaseItem>
     /// </summary>
     /// </summary>
-    public class ApiBaseItemWrapper : BaseItemWrapper<ApiBaseItem>
+    public class ApiBaseItemContainer : BaseItemContainer<ApiBaseItem>
     {
     {
     }
     }
 }
 }

+ 0 - 19
MediaBrowser.Model/DTO/CategoryInfo.cs

@@ -1,19 +0,0 @@
-
-namespace MediaBrowser.Model.DTO
-{
-    /// <summary>
-    /// This is a stub class used by the api to get IBN types along with their item counts
-    /// </summary>
-    public class CategoryInfo<T>
-    {
-        /// <summary>
-        /// The actual genre, year, studio, etc
-        /// </summary>
-        public T Item { get; set; }
-
-        /// <summary>
-        /// The number of items that have the genre, year, studio, etc
-        /// </summary>
-        public int ItemCount { get; set; }
-    }
-}

+ 38 - 0
MediaBrowser.Model/DTO/IBNItem.cs

@@ -0,0 +1,38 @@
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.DTO
+{
+    /// <summary>
+    /// This is a stub class used by the api to get IBN types along with their item counts
+    /// </summary>
+    public class IBNItem<T>
+    {
+        /// <summary>
+        /// The actual genre, year, studio, etc
+        /// </summary>
+        public T Item { get; set; }
+
+        /// <summary>
+        /// The number of items that have the genre, year, studio, etc
+        /// </summary>
+        public int BaseItemCount { get; set; }
+    }
+
+    /// <summary>
+    /// This is used by BaseItemContainer
+    /// </summary>
+    public class BaseItemPerson
+    {
+        public PersonInfo PersonInfo { get; set; }
+        public string PrimaryImagePath { get; set; }
+    }
+
+    /// <summary>
+    /// This is used by BaseItemContainer
+    /// </summary>
+    public class BaseItemStudio
+    {
+        public string Name { get; set; }
+        public string PrimaryImagePath { get; set; }
+    }
+}

+ 0 - 1
MediaBrowser.Model/Entities/Person.cs

@@ -6,7 +6,6 @@ namespace MediaBrowser.Model.Entities
     /// </summary>
     /// </summary>
     public class Person : BaseEntity
     public class Person : BaseEntity
     {
     {
-        public PersonType PersonType { get; set; }
     }
     }
 
 
     /// <summary>
     /// <summary>

+ 1 - 2
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -32,12 +32,11 @@
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
-    <Compile Include="Configuration\UserConfiguration.cs" />
     <Compile Include="DTO\ApiBaseItem.cs" />
     <Compile Include="DTO\ApiBaseItem.cs" />
     <Compile Include="Entities\Audio.cs" />
     <Compile Include="Entities\Audio.cs" />
     <Compile Include="Entities\BaseEntity.cs" />
     <Compile Include="Entities\BaseEntity.cs" />
     <Compile Include="Entities\BaseItem.cs" />
     <Compile Include="Entities\BaseItem.cs" />
-    <Compile Include="DTO\CategoryInfo.cs" />
+    <Compile Include="DTO\IBNItem.cs" />
     <Compile Include="Entities\Folder.cs" />
     <Compile Include="Entities\Folder.cs" />
     <Compile Include="Entities\Genre.cs" />
     <Compile Include="Entities\Genre.cs" />
     <Compile Include="Entities\ImageType.cs" />
     <Compile Include="Entities\ImageType.cs" />

+ 7 - 0
MediaBrowser.Model/Users/User.cs

@@ -10,5 +10,12 @@ namespace MediaBrowser.Model.Users
 
 
         private Dictionary<Guid, UserItemData> _ItemData = new Dictionary<Guid, UserItemData>();
         private Dictionary<Guid, UserItemData> _ItemData = new Dictionary<Guid, UserItemData>();
         public Dictionary<Guid, UserItemData> ItemData { get { return _ItemData; } set { _ItemData = value; } }
         public Dictionary<Guid, UserItemData> ItemData { get { return _ItemData; } set { _ItemData = value; } }
+
+        public int RecentItemDays { get; set; }
+
+        public User()
+        {
+            RecentItemDays = 14;
+        }
     }
     }
 }
 }