Explorar o código

Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser

Techywarrior %!s(int64=12) %!d(string=hai) anos
pai
achega
419d851167
Modificáronse 27 ficheiros con 480 adicións e 106 borrados
  1. 7 2
      MediaBrowser.Api/BaseApiService.cs
  2. 110 18
      MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs
  3. 3 3
      MediaBrowser.Api/UserLibrary/GenresService.cs
  4. 30 6
      MediaBrowser.Api/UserLibrary/ItemsService.cs
  5. 4 5
      MediaBrowser.Api/UserLibrary/PersonsService.cs
  6. 3 3
      MediaBrowser.Api/UserLibrary/StudiosService.cs
  7. 3 3
      MediaBrowser.Api/UserLibrary/YearsService.cs
  8. 2 4
      MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
  9. 106 0
      MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs
  10. 109 0
      MediaBrowser.Common.Implementations/Security/MBRegistration.cs
  11. 1 1
      MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs
  12. 4 5
      MediaBrowser.Controller/Entities/BaseItem.cs
  13. 1 1
      MediaBrowser.Controller/Entities/Folder.cs
  14. 13 1
      MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
  15. 14 1
      MediaBrowser.Controller/Providers/ImagesByNameProvider.cs
  16. 3 3
      MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs
  17. 1 1
      MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs
  18. 4 4
      MediaBrowser.Model/Entities/MBRegistrationRecord.cs
  19. 4 0
      MediaBrowser.Model/Entities/PersonType.cs
  20. 1 1
      MediaBrowser.Model/Querying/ItemQuery.cs
  21. 36 36
      MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
  22. 13 0
      MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs
  23. 1 1
      MediaBrowser.Server.Implementations/Library/LibraryManager.cs
  24. 2 2
      MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs
  25. 2 2
      Nuget/MediaBrowser.Common.Internal.nuspec
  26. 1 1
      Nuget/MediaBrowser.Common.nuspec
  27. 2 2
      Nuget/MediaBrowser.Server.Core.nuspec

+ 7 - 2
MediaBrowser.Api/BaseApiService.cs

@@ -110,9 +110,14 @@ namespace MediaBrowser.Api
 
 
             if (auth != null && auth.ContainsKey("UserId"))
             if (auth != null && auth.ContainsKey("UserId"))
             {
             {
-                var user = UserManager.GetUserById(new Guid(auth["UserId"]));
+                var userId = auth["UserId"];
 
 
-                UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
+                if (!string.IsNullOrEmpty(userId))
+                {
+                    var user = UserManager.GetUserById(new Guid(userId));
+
+                    UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
+                }
             }
             }
         }
         }
 
 

+ 110 - 18
MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs

@@ -70,9 +70,13 @@ namespace MediaBrowser.Api.UserLibrary
             items = FilterItems(request, items, user);
             items = FilterItems(request, items, user);
 
 
             var extractedItems = GetAllItems(request, items, user);
             var extractedItems = GetAllItems(request, items, user);
-            var ibnItemsArray = SortItems(request, extractedItems).ToArray();
-      
-            IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> ibnItems = ibnItemsArray;
+
+            extractedItems = FilterItems(request, extractedItems, user);
+            extractedItems = SortItems(request, extractedItems);
+
+            var ibnItemsArray = extractedItems.ToArray();
+
+            IEnumerable<IbnStub<TItemType>> ibnItems = ibnItemsArray;
 
 
             var result = new ItemsResult
             var result = new ItemsResult
             {
             {
@@ -104,23 +108,74 @@ namespace MediaBrowser.Api.UserLibrary
             return result;
             return result;
         }
         }
 
 
+        /// <summary>
+        /// Filters the items.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="items">The items.</param>
+        /// <param name="user">The user.</param>
+        /// <returns>IEnumerable{IbnStub}.</returns>
+        private IEnumerable<IbnStub<TItemType>> FilterItems(GetItemsByName request, IEnumerable<IbnStub<TItemType>> items, User user)
+        {
+            var filters = request.GetFilters().ToList();
+
+            if (filters.Count == 0)
+            {
+                return items;
+            }
+
+            items = items.AsParallel();
+
+            if (filters.Contains(ItemFilter.Dislikes))
+            {
+                items = items.Where(i =>
+                {
+                    var userdata = i.GetUserItemData(UserDataRepository, user.Id).Result;
+
+                    return userdata != null && userdata.Likes.HasValue && !userdata.Likes.Value;
+                });
+            }
+
+            if (filters.Contains(ItemFilter.Likes))
+            {
+                items = items.Where(i =>
+                {
+                    var userdata = i.GetUserItemData(UserDataRepository, user.Id).Result;
+
+                    return userdata != null && userdata.Likes.HasValue && userdata.Likes.Value;
+                });
+            }
+
+            if (filters.Contains(ItemFilter.IsFavorite))
+            {
+                items = items.Where(i =>
+                {
+                    var userdata = i.GetUserItemData(UserDataRepository, user.Id).Result;
+
+                    return userdata != null && userdata.Likes.HasValue && userdata.IsFavorite;
+                });
+            }
+            
+            return items.AsEnumerable();
+        }
+        
         /// <summary>
         /// <summary>
         /// Sorts the items.
         /// Sorts the items.
         /// </summary>
         /// </summary>
         /// <param name="request">The request.</param>
         /// <param name="request">The request.</param>
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <returns>IEnumerable{BaseItem}.</returns>
         /// <returns>IEnumerable{BaseItem}.</returns>
-        private IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> SortItems(GetItemsByName request, IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> items)
+        private IEnumerable<IbnStub<TItemType>> SortItems(GetItemsByName request, IEnumerable<IbnStub<TItemType>> items)
         {
         {
             if (string.Equals(request.SortBy, "SortName", StringComparison.OrdinalIgnoreCase))
             if (string.Equals(request.SortBy, "SortName", StringComparison.OrdinalIgnoreCase))
             {
             {
                 if (request.SortOrder.HasValue && request.SortOrder.Value == Model.Entities.SortOrder.Descending)
                 if (request.SortOrder.HasValue && request.SortOrder.Value == Model.Entities.SortOrder.Descending)
                 {
                 {
-                    items = items.OrderByDescending(i => i.Item1);
+                    items = items.OrderByDescending(i => i.Name);
                 }
                 }
                 else
                 else
                 {
                 {
-                    items = items.OrderBy(i => i.Item1);
+                    items = items.OrderBy(i => i.Name);
                 }
                 }
             }
             }
 
 
@@ -160,14 +215,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
-        protected abstract IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user);
-
-        /// <summary>
-        /// Gets the entity.
-        /// </summary>
-        /// <param name="name">The name.</param>
-        /// <returns>Task{BaseItem}.</returns>
-        protected abstract Task<TItemType> GetEntity(string name);
+        protected abstract IEnumerable<IbnStub<TItemType>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user);
 
 
         /// <summary>
         /// <summary>
         /// Gets the dto.
         /// Gets the dto.
@@ -176,17 +224,17 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <param name="fields">The fields.</param>
         /// <param name="fields">The fields.</param>
         /// <returns>Task{DtoBaseItem}.</returns>
         /// <returns>Task{DtoBaseItem}.</returns>
-        private async Task<BaseItemDto> GetDto(Tuple<string, Func<IEnumerable<BaseItem>>> stub, User user, List<ItemFields> fields)
+        private async Task<BaseItemDto> GetDto(IbnStub<TItemType> stub, User user, List<ItemFields> fields)
         {
         {
             BaseItem item;
             BaseItem item;
 
 
             try
             try
             {
             {
-                item = await GetEntity(stub.Item1).ConfigureAwait(false);
+                item = await stub.GetItem().ConfigureAwait(false);
             }
             }
             catch (IOException ex)
             catch (IOException ex)
             {
             {
-                Logger.ErrorException("Error getting IBN item {0}", ex, stub.Item1);
+                Logger.ErrorException("Error getting IBN item {0}", ex, stub.Name);
                 return null;
                 return null;
             }
             }
 
 
@@ -194,7 +242,7 @@ namespace MediaBrowser.Api.UserLibrary
 
 
             if (fields.Contains(ItemFields.ItemCounts))
             if (fields.Contains(ItemFields.ItemCounts))
             {
             {
-                var items = stub.Item2().ToList();
+                var items = stub.Items;
 
 
                 dto.ChildCount = items.Count;
                 dto.ChildCount = items.Count;
                 dto.RecentlyAddedItemCount = items.Count(i => i.IsRecentlyAdded(user));
                 dto.RecentlyAddedItemCount = items.Count(i => i.IsRecentlyAdded(user));
@@ -216,4 +264,48 @@ namespace MediaBrowser.Api.UserLibrary
         [ApiMember(Name = "SortBy", Description = "Optional. Options: SortName", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         [ApiMember(Name = "SortBy", Description = "Optional. Options: SortName", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         public string SortBy { get; set; }
         public string SortBy { get; set; }
     }
     }
+
+    public class IbnStub<T>
+        where T : BaseItem
+    {
+        private readonly Func<IEnumerable<BaseItem>> _childItemsFunction;
+        private List<BaseItem> _childItems;
+
+        private readonly Func<string,Task<T>> _itemFunction;
+        private Task<T> _itemTask;
+        
+        public string Name;
+
+        public BaseItem Item;
+        private Task<UserItemData> _userData;
+
+        public List<BaseItem> Items
+        {
+            get { return _childItems ?? (_childItems = _childItemsFunction().ToList()); }
+        }
+
+        public Task<T> GetItem()
+        {
+            return _itemTask ?? (_itemTask = _itemFunction(Name));
+        }
+
+        public async Task<UserItemData> GetUserItemData(IUserDataRepository repo, Guid userId)
+        {
+            var item = await GetItem().ConfigureAwait(false);
+
+            if (_userData == null)
+            {
+                _userData = repo.GetUserData(userId, item.GetUserDataKey());
+            }
+
+            return await _userData.ConfigureAwait(false);
+        }
+
+        public IbnStub(string name, Func<IEnumerable<BaseItem>> childItems, Func<string,Task<T>> item)
+        {
+            Name = name;
+            _childItemsFunction = childItems;
+            _itemFunction = item;
+        }
+    }
 }
 }

+ 3 - 3
MediaBrowser.Api/UserLibrary/GenresService.cs

@@ -48,14 +48,14 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
-        protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
+        protected override IEnumerable<IbnStub<Genre>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
         {
         {
             var itemsList = items.Where(i => i.Genres != null).ToList();
             var itemsList = items.Where(i => i.Genres != null).ToList();
 
 
             return itemsList
             return itemsList
                 .SelectMany(i => i.Genres)
                 .SelectMany(i => i.Genres)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
-                .Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase))));
+                .Select(name => new IbnStub<Genre>(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)), GetEntity));
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -63,7 +63,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// </summary>
         /// </summary>
         /// <param name="name">The name.</param>
         /// <param name="name">The name.</param>
         /// <returns>Task{Genre}.</returns>
         /// <returns>Task{Genre}.</returns>
-        protected override Task<Genre> GetEntity(string name)
+        protected Task<Genre> GetEntity(string name)
         {
         {
             return LibraryManager.GetGenre(name);
             return LibraryManager.GetGenre(name);
         }
         }

+ 30 - 6
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -38,8 +38,8 @@ namespace MediaBrowser.Api.UserLibrary
         /// If the Person filter is used, this can also be used to restrict to a specific person type
         /// If the Person filter is used, this can also be used to restrict to a specific person type
         /// </summary>
         /// </summary>
         /// <value>The type of the person.</value>
         /// <value>The type of the person.</value>
-        [ApiMember(Name = "PersonType", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
-        public string PersonType { get; set; }
+        [ApiMember(Name = "PersonTypes", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+        public string PersonTypes { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Search characters used to find items
         /// Search characters used to find items
@@ -357,6 +357,20 @@ namespace MediaBrowser.Api.UserLibrary
         /// <returns>IEnumerable{BaseItem}.</returns>
         /// <returns>IEnumerable{BaseItem}.</returns>
         internal static IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items)
         internal static IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items)
         {
         {
+            // Exclude item types
+            if (!string.IsNullOrEmpty(request.ExcludeItemTypes))
+            {
+                var vals = request.ExcludeItemTypes.Split(',');
+                items = items.Where(f => !vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase));
+            }
+
+            // Include item types
+            if (!string.IsNullOrEmpty(request.IncludeItemTypes))
+            {
+                var vals = request.IncludeItemTypes.Split(',');
+                items = items.Where(f => vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase));
+            }
+            
             // Filter by Series Status
             // Filter by Series Status
             if (!string.IsNullOrEmpty(request.SeriesStatus))
             if (!string.IsNullOrEmpty(request.SeriesStatus))
             {
             {
@@ -434,11 +448,21 @@ namespace MediaBrowser.Api.UserLibrary
             // Apply person filter
             // Apply person filter
             if (!string.IsNullOrEmpty(personName))
             if (!string.IsNullOrEmpty(personName))
             {
             {
-                var personType = request.PersonType;
+                var personTypes = request.PersonTypes;
 
 
-                items = !string.IsNullOrEmpty(personType)
-                            ? items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(personType, StringComparison.OrdinalIgnoreCase)))
-                            : items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase)));
+                if (string.IsNullOrEmpty(personTypes))
+                {
+                    items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, personName, StringComparison.OrdinalIgnoreCase)));
+                }
+                else
+                {
+                    var types = personTypes.Split(',');
+
+                    items = items.Where(item =>
+                            item.People != null &&
+                            item.People.Any(p =>
+                                p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && types.Contains(p.Type, StringComparer.OrdinalIgnoreCase)));
+                }
             }
             }
 
 
             return items;
             return items;

+ 4 - 5
MediaBrowser.Api/UserLibrary/PersonsService.cs

@@ -53,7 +53,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
-        protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
+        protected override IEnumerable<IbnStub<Person>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
         {
         {
             var inputPersonTypes = ((GetPersons) request).PersonTypes;
             var inputPersonTypes = ((GetPersons) request).PersonTypes;
             var personTypes = string.IsNullOrEmpty(inputPersonTypes) ? new string[] { } : inputPersonTypes.Split(',');
             var personTypes = string.IsNullOrEmpty(inputPersonTypes) ? new string[] { } : inputPersonTypes.Split(',');
@@ -67,7 +67,7 @@ namespace MediaBrowser.Api.UserLibrary
                 .Select(i => i.Name)
                 .Select(i => i.Name)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
 
 
-                .Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(name, () =>
+                .Select(name => new IbnStub<Person>(name, () =>
                 {
                 {
                     if (personTypes.Length == 0)
                     if (personTypes.Length == 0)
                     {
                     {
@@ -75,7 +75,7 @@ namespace MediaBrowser.Api.UserLibrary
                     }
                     }
 
 
                     return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase)));
                     return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase)));
-                })
+                }, GetEntity)
             );
             );
         }
         }
 
 
@@ -89,7 +89,6 @@ namespace MediaBrowser.Api.UserLibrary
         {
         {
             var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.Type));
             var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.Type));
 
 
-
             return personTypes.Length == 0 ?
             return personTypes.Length == 0 ?
 
 
                 people :
                 people :
@@ -102,7 +101,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// </summary>
         /// </summary>
         /// <param name="name">The name.</param>
         /// <param name="name">The name.</param>
         /// <returns>Task{Genre}.</returns>
         /// <returns>Task{Genre}.</returns>
-        protected override Task<Person> GetEntity(string name)
+        protected Task<Person> GetEntity(string name)
         {
         {
             return LibraryManager.GetPerson(name);
             return LibraryManager.GetPerson(name);
         }
         }

+ 3 - 3
MediaBrowser.Api/UserLibrary/StudiosService.cs

@@ -48,14 +48,14 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
-        protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
+        protected override IEnumerable<IbnStub<Studio>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
         {
         {
             var itemsList = items.Where(i => i.Studios != null).ToList();
             var itemsList = items.Where(i => i.Studios != null).ToList();
 
 
             return itemsList
             return itemsList
                 .SelectMany(i => i.Studios)
                 .SelectMany(i => i.Studios)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .Distinct(StringComparer.OrdinalIgnoreCase)
-                .Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(name, () => itemsList.Where(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase))));
+                .Select(name => new IbnStub<Studio>(name, () => itemsList.Where(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase)), GetEntity));
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -63,7 +63,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// </summary>
         /// </summary>
         /// <param name="name">The name.</param>
         /// <param name="name">The name.</param>
         /// <returns>Task{Studio}.</returns>
         /// <returns>Task{Studio}.</returns>
-        protected override Task<Studio> GetEntity(string name)
+        protected Task<Studio> GetEntity(string name)
         {
         {
             return LibraryManager.GetStudio(name);
             return LibraryManager.GetStudio(name);
         }
         }

+ 3 - 3
MediaBrowser.Api/UserLibrary/YearsService.cs

@@ -54,14 +54,14 @@ namespace MediaBrowser.Api.UserLibrary
         /// <param name="items">The items.</param>
         /// <param name="items">The items.</param>
         /// <param name="user">The user.</param>
         /// <param name="user">The user.</param>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
         /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
-        protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
+        protected override IEnumerable<IbnStub<Year>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
         {
         {
             var itemsList = items.Where(i => i.ProductionYear != null).ToList();
             var itemsList = items.Where(i => i.ProductionYear != null).ToList();
 
 
             return itemsList
             return itemsList
                 .Select(i => i.ProductionYear.Value)
                 .Select(i => i.ProductionYear.Value)
                 .Distinct()
                 .Distinct()
-                .Select(year => new Tuple<string, Func<IEnumerable<BaseItem>>>(year.ToString(UsCulture), () => itemsList.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year)));
+                .Select(year => new IbnStub<Year>(year.ToString(UsCulture), () => itemsList.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year), GetEntity));
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -69,7 +69,7 @@ namespace MediaBrowser.Api.UserLibrary
         /// </summary>
         /// </summary>
         /// <param name="name">The name.</param>
         /// <param name="name">The name.</param>
         /// <returns>Task{Studio}.</returns>
         /// <returns>Task{Studio}.</returns>
-        protected override Task<Year> GetEntity(string name)
+        protected Task<Year> GetEntity(string name)
         {
         {
             return LibraryManager.GetYear(int.Parse(name, UsCulture));
             return LibraryManager.GetYear(int.Parse(name, UsCulture));
         }
         }

+ 2 - 4
MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj

@@ -35,9 +35,6 @@
     <RunPostBuildEvent>Always</RunPostBuildEvent>
     <RunPostBuildEvent>Always</RunPostBuildEvent>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
-    <Reference Include="Mediabrowser.PluginSecurity">
-      <HintPath>..\ThirdParty\PluginSecurity\Mediabrowser.PluginSecurity.dll</HintPath>
-    </Reference>
     <Reference Include="NLog">
     <Reference Include="NLog">
       <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
       <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
     </Reference>
     </Reference>
@@ -79,6 +76,8 @@
     <Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\ReloadLoggerTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\SystemUpdateTask.cs" />
     <Compile Include="ScheduledTasks\Tasks\SystemUpdateTask.cs" />
+    <Compile Include="Security\MBLicenseFile.cs" />
+    <Compile Include="Security\MBRegistration.cs" />
     <Compile Include="Security\PluginSecurityManager.cs" />
     <Compile Include="Security\PluginSecurityManager.cs" />
     <Compile Include="Serialization\JsonSerializer.cs" />
     <Compile Include="Serialization\JsonSerializer.cs" />
     <Compile Include="Serialization\XmlSerializer.cs" />
     <Compile Include="Serialization\XmlSerializer.cs" />
@@ -104,7 +103,6 @@
   <PropertyGroup>
   <PropertyGroup>
     <PostBuildEvent>if $(ConfigurationName) == Release (
     <PostBuildEvent>if $(ConfigurationName) == Release (
 xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
 xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
-xcopy "$(TargetDir)Mediabrowser.PluginSecurity.dll" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
 )</PostBuildEvent>
 )</PostBuildEvent>
   </PropertyGroup>
   </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 106 - 0
MediaBrowser.Common.Implementations/Security/MBLicenseFile.cs

@@ -0,0 +1,106 @@
+using MediaBrowser.Common.Configuration;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Mediabrowser.Common.Implementations.Security
+{
+    internal class MBLicenseFile
+    {
+        private readonly IApplicationPaths _appPaths;
+
+        private readonly string _filename;
+        public string RegKey
+        {
+            get { return _regKey; }
+            set
+            {
+                if (value != _regKey)
+                {
+                    //if key is changed - clear out our saved validations
+                    UpdateRecords.Clear();
+                    _regKey = value;
+                }
+            }
+        }
+
+        public string LegacyKey { get; set; }
+        private Dictionary<Guid, DateTime> UpdateRecords { get; set; }
+        private readonly object _lck = new object();
+        private string _regKey;
+
+        public MBLicenseFile(IApplicationPaths appPaths)
+        {
+            _appPaths = appPaths;
+
+            _filename = Path.Combine(_appPaths.ConfigurationDirectoryPath, "mb.lic");
+
+            UpdateRecords = new Dictionary<Guid, DateTime>();
+            Load();
+        }
+
+        public void AddRegCheck(string featureId)
+        {
+            using (var provider = new MD5CryptoServiceProvider())
+            {
+                UpdateRecords[new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(featureId)))] = DateTime.UtcNow;
+                Save();
+            }
+
+        }
+
+        public DateTime LastChecked(string featureId)
+        {
+            using (var provider = new MD5CryptoServiceProvider())
+            {
+                DateTime last;
+                lock(_lck) UpdateRecords.TryGetValue(new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(featureId))), out last);
+                return last < DateTime.UtcNow ? last : DateTime.MinValue;  // guard agains people just putting a large number in the file
+            }
+        }
+
+        private void Load()
+        {
+            string[] contents = null;
+            lock (_lck)
+            {
+                try
+                {
+                    contents = File.ReadAllLines(_filename);
+                }
+                catch (FileNotFoundException)
+                {
+                    (File.Create(_filename)).Close();
+                }
+            }
+            if (contents != null && contents.Length > 0)
+            {
+                //first line is reg key
+                RegKey = contents[0];
+                //next is legacy key
+                if (contents.Length > 1) LegacyKey = contents[1];
+                //the rest of the lines should be pairs of features and timestamps
+                for (var i = 2; i < contents.Length; i = i + 2)
+                {
+                    var feat = Guid.Parse(contents[i]);
+                    UpdateRecords[feat] = new DateTime(Convert.ToInt64(contents[i + 1]));
+                }
+            }
+        }
+
+        public void Save()
+        {
+            //build our array
+            var lines = new List<string> {RegKey, LegacyKey};
+            foreach (var pair in UpdateRecords)
+            {
+                lines.Add(pair.Key.ToString());
+                lines.Add(pair.Value.Ticks.ToString());
+            }
+
+            lock(_lck) File.WriteAllLines(_filename, lines);
+        }
+    }
+}

+ 109 - 0
MediaBrowser.Common.Implementations/Security/MBRegistration.cs

@@ -0,0 +1,109 @@
+using Mediabrowser.Model.Entities;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Model.Serialization;
+using System;
+using System.Collections.Generic;
+using System.Management;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Mediabrowser.Common.Implementations.Security
+{
+    public static class MBRegistration
+    {
+
+        private static MBLicenseFile _licenseFile;
+        private const string MBValidateUrl = "http://mb3admin.com/admin/service/registration/validate";
+
+        private static IApplicationPaths _appPaths;
+
+        private static MBLicenseFile LicenseFile
+        {
+            get { return _licenseFile ?? (_licenseFile = new MBLicenseFile(_appPaths)); }
+        }
+
+        public static string SupporterKey
+        {
+            get { return LicenseFile.RegKey; }
+            set { LicenseFile.RegKey = value; LicenseFile.Save(); }
+        }
+
+        public static string LegacyKey
+        {
+            get { return LicenseFile.LegacyKey; }
+            set { LicenseFile.LegacyKey = value; LicenseFile.Save(); }
+        }
+
+        public static void Init(IApplicationPaths appPaths)
+        {
+            // Ugly alert (static init)
+
+            _appPaths = appPaths;
+        }
+
+        public static async Task<MBRegistrationRecord> GetRegistrationStatus(IHttpClient httpClient, IJsonSerializer jsonSerializer, string feature, string mb2Equivalent = null)
+        {
+            var mac = GetMacAddress();
+            var data = new Dictionary<string, string> {{"feature", feature}, {"key",SupporterKey}, {"mac",mac}, {"mb2equiv",mb2Equivalent}, {"legacykey", LegacyKey} };
+
+            var reg = new RegRecord();
+            try
+            {
+                using (var json = await httpClient.Post(MBValidateUrl, data, CancellationToken.None).ConfigureAwait(false))
+                {
+                    reg = jsonSerializer.DeserializeFromStream<RegRecord>(json);
+                }
+
+                if (reg.registered)
+                {
+                    LicenseFile.AddRegCheck(feature);
+                }
+
+            }
+            catch (Exception)
+            {
+                //if we have trouble obtaining from web - allow it if we've validated in the past 30 days
+                reg.registered = LicenseFile.LastChecked(feature) > DateTime.UtcNow.AddDays(-30);
+            }
+
+            return new MBRegistrationRecord {IsRegistered = reg.registered, ExpirationDate = reg.expDate, RegChecked = true};
+        }
+
+        /// <summary>
+        /// Returns MAC Address from first Network Card in Computer
+        /// </summary>
+        /// <returns>[string] MAC Address</returns>
+        public static string GetMacAddress()
+        {
+            var mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
+            var moc = mc.GetInstances();
+            var macAddress = String.Empty;
+            foreach (ManagementObject mo in moc)
+            {
+                if (macAddress == String.Empty)  // only return MAC Address from first card
+                {
+                    try
+                    {
+                        if ((bool)mo["IPEnabled"]) macAddress = mo["MacAddress"].ToString();
+                    }
+                    catch
+                    {
+                        mo.Dispose();
+                        return "";
+                    }
+                }
+                mo.Dispose();
+            }
+
+            return macAddress.Replace(":", "");
+        }
+    }
+
+    class RegRecord
+    {
+        public string featId { get; set; }
+        public bool registered { get; set; }
+        public DateTime expDate { get; set; }
+    }
+}

+ 1 - 1
MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs

@@ -2,8 +2,8 @@
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Security;
 using MediaBrowser.Common.Security;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Serialization;
+using Mediabrowser.Common.Implementations.Security;
 using Mediabrowser.Model.Entities;
 using Mediabrowser.Model.Entities;
-using Mediabrowser.PluginSecurity;
 using MediaBrowser.Common.Net;
 using MediaBrowser.Common.Net;
 using System;
 using System;
 using System.Threading;
 using System.Threading;

+ 4 - 5
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Localization;
 using MediaBrowser.Controller.Localization;
@@ -33,7 +32,7 @@ namespace MediaBrowser.Controller.Entities
         /// Gets or sets the name.
         /// Gets or sets the name.
         /// </summary>
         /// </summary>
         /// <value>The name.</value>
         /// <value>The name.</value>
-        public virtual string Name { get; set; }
+        public string Name { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets the id.
         /// Gets or sets the id.
@@ -478,7 +477,7 @@ namespace MediaBrowser.Controller.Entities
         /// </summary>
         /// </summary>
         /// <value>The end date.</value>
         /// <value>The end date.</value>
         public DateTime? EndDate { get; set; }
         public DateTime? EndDate { get; set; }
-        
+
         /// <summary>
         /// <summary>
         /// Gets or sets the display type of the media.
         /// Gets or sets the display type of the media.
         /// </summary>
         /// </summary>
@@ -570,7 +569,7 @@ namespace MediaBrowser.Controller.Entities
         /// </summary>
         /// </summary>
         /// <value>The production locations.</value>
         /// <value>The production locations.</value>
         public List<string> ProductionLocations { get; set; }
         public List<string> ProductionLocations { get; set; }
-        
+
         /// <summary>
         /// <summary>
         /// Gets or sets the community rating.
         /// Gets or sets the community rating.
         /// </summary>
         /// </summary>

+ 1 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -127,7 +127,7 @@ namespace MediaBrowser.Controller.Entities
         /// <returns>IEnumerable{BaseItem}.</returns>
         /// <returns>IEnumerable{BaseItem}.</returns>
         protected IEnumerable<BaseItem> GetIndexByPerformer(User user)
         protected IEnumerable<BaseItem> GetIndexByPerformer(User user)
         {
         {
-            return GetIndexByPerson(user, new List<string> { PersonType.Actor, PersonType.MusicArtist }, LocalizedStrings.Instance.GetString("PerformerDispPref"));
+            return GetIndexByPerson(user, new List<string> { PersonType.Actor, PersonType.MusicArtist, PersonType.GuestStar }, LocalizedStrings.Instance.GetString("PerformerDispPref"));
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 13 - 1
MediaBrowser.Controller/Providers/BaseItemXmlParser.cs

@@ -242,7 +242,6 @@ namespace MediaBrowser.Controller.Providers
                     }
                     }
 
 
                 case "Actors":
                 case "Actors":
-                case "GuestStars":
                     {
                     {
                         foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Actor }))
                         foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Actor }))
                         {
                         {
@@ -255,6 +254,19 @@ namespace MediaBrowser.Controller.Providers
                         break;
                         break;
                     }
                     }
 
 
+                case "GuestStars":
+                    {
+                        foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar }))
+                        {
+                            if (string.IsNullOrWhiteSpace(p.Name))
+                            {
+                                continue;
+                            }
+                            item.AddPerson(p);
+                        }
+                        break;
+                    }
+
                 case "Trailer":
                 case "Trailer":
                     {
                     {
                         var val = reader.ReadElementContentAsString();
                         var val = reader.ReadElementContentAsString();

+ 14 - 1
MediaBrowser.Controller/Providers/ImagesByNameProvider.cs

@@ -63,7 +63,20 @@ namespace MediaBrowser.Controller.Providers
         {
         {
             // If the IBN location exists return the last modified date of any file in it
             // If the IBN location exists return the last modified date of any file in it
             var location = GetLocation(item);
             var location = GetLocation(item);
-            return Directory.Exists(location) ? FileSystem.GetFiles(location).Select(f => f.CreationTimeUtc > f.LastWriteTimeUtc ? f.CreationTimeUtc : f.LastWriteTimeUtc).Max() : DateTime.MinValue;
+
+            if (!Directory.Exists(location))
+            {
+                return DateTime.MinValue;
+            }
+
+            var files = FileSystem.GetFiles(location).ToList();
+
+            if (files.Count == 0)
+            {
+                return DateTime.MinValue;
+            }
+
+            return files.Select(f => f.CreationTimeUtc > f.LastWriteTimeUtc ? f.CreationTimeUtc : f.LastWriteTimeUtc).Max();
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 3 - 3
MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs

@@ -263,21 +263,21 @@ namespace MediaBrowser.Controller.Providers.TV
                     var actors = doc.SafeGetString("//GuestStars");
                     var actors = doc.SafeGetString("//GuestStars");
                     if (actors != null)
                     if (actors != null)
                     {
                     {
-                        episode.AddPeople(actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Actor", Name = str }));
+                        episode.AddPeople(actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str }));
                     }
                     }
 
 
 
 
                     var directors = doc.SafeGetString("//Director");
                     var directors = doc.SafeGetString("//Director");
                     if (directors != null)
                     if (directors != null)
                     {
                     {
-                        episode.AddPeople(directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Director", Name = str }));
+                        episode.AddPeople(directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Director, Name = str }));
                     }
                     }
 
 
 
 
                     var writers = doc.SafeGetString("//Writer");
                     var writers = doc.SafeGetString("//Writer");
                     if (writers != null)
                     if (writers != null)
                     {
                     {
-                        episode.AddPeople(writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Writer", Name = str }));
+                        episode.AddPeople(writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Writer, Name = str }));
                     }
                     }
 
 
                     if (ConfigurationManager.Configuration.SaveLocalMeta)
                     if (ConfigurationManager.Configuration.SaveLocalMeta)

+ 1 - 1
MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs

@@ -322,7 +322,7 @@ namespace MediaBrowser.Controller.Providers.TV
                                     personNode.AppendChild(doc.ImportNode(subNode, true));
                                     personNode.AppendChild(doc.ImportNode(subNode, true));
                                 //need to add the type
                                 //need to add the type
                                 var typeNode = doc.CreateNode(XmlNodeType.Element, "Type", null);
                                 var typeNode = doc.CreateNode(XmlNodeType.Element, "Type", null);
-                                typeNode.InnerText = "Actor";
+                                typeNode.InnerText = PersonType.Actor;
                                 personNode.AppendChild(typeNode);
                                 personNode.AppendChild(typeNode);
                                 actorsNode.AppendChild(personNode);
                                 actorsNode.AppendChild(personNode);
                             }
                             }

+ 4 - 4
MediaBrowser.Model/Entities/MBRegistrationRecord.cs

@@ -4,10 +4,10 @@ namespace Mediabrowser.Model.Entities
 {
 {
     public class MBRegistrationRecord
     public class MBRegistrationRecord
     {
     {
-        public DateTime ExpirationDate = DateTime.MinValue;
-        public bool IsRegistered = false;
-        public bool RegChecked = false;
-        public bool RegError = false;
+        public DateTime ExpirationDate { get; set; }
+        public bool IsRegistered { get; set;}
+        public bool RegChecked { get; set; }
+        public bool RegError { get; set; }
         private bool? _isInTrial;
         private bool? _isInTrial;
         public bool TrialVersion
         public bool TrialVersion
         {
         {

+ 4 - 0
MediaBrowser.Model/Entities/PersonType.cs

@@ -26,5 +26,9 @@ namespace MediaBrowser.Model.Entities
         /// The music artist
         /// The music artist
         /// </summary>
         /// </summary>
         public const string MusicArtist = "MusicArtist";
         public const string MusicArtist = "MusicArtist";
+        /// <summary>
+        /// The guest star
+        /// </summary>
+        public const string GuestStar = "GuestStar";
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Model/Querying/ItemQuery.cs

@@ -120,7 +120,7 @@ namespace MediaBrowser.Model.Querying
         /// If the Person filter is used, this can also be used to restrict to a specific person type
         /// If the Person filter is used, this can also be used to restrict to a specific person type
         /// </summary>
         /// </summary>
         /// <value>The type of the person.</value>
         /// <value>The type of the person.</value>
-        public string PersonType { get; set; }
+        public string[] PersonTypes { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Search characters used to find items
         /// Search characters used to find items

+ 36 - 36
MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs

@@ -105,6 +105,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
             DefaultRedirectPath = defaultRedirectpath;
             DefaultRedirectPath = defaultRedirectpath;
             _logger = logger;
             _logger = logger;
 
 
+            ServiceStack.Logging.LogManager.LogFactory = new NLogFactory();
+            
             EndpointHostConfig.Instance.ServiceStackHandlerFactoryPath = null;
             EndpointHostConfig.Instance.ServiceStackHandlerFactoryPath = null;
             EndpointHostConfig.Instance.MetadataRedirectPath = "metadata";
             EndpointHostConfig.Instance.MetadataRedirectPath = "metadata";
 
 
@@ -136,58 +138,56 @@ namespace MediaBrowser.Server.Implementations.HttpServer
             Plugins.Add(new SwaggerFeature());
             Plugins.Add(new SwaggerFeature());
             Plugins.Add(new CorsFeature());
             Plugins.Add(new CorsFeature());
 
 
-            ServiceStack.Logging.LogManager.LogFactory = new NLogFactory();
-
             ResponseFilters.Add((req, res, dto) =>
             ResponseFilters.Add((req, res, dto) =>
+            {
+                var exception = dto as Exception;
+
+                if (exception != null)
                 {
                 {
-                    var exception = dto as Exception;
+                    _logger.ErrorException("Error processing request for {0}", exception, req.RawUrl);
 
 
-                    if (exception != null)
+                    if (!string.IsNullOrEmpty(exception.Message))
                     {
                     {
-                        _logger.ErrorException("Error processing request for {0}", exception, req.RawUrl);
-
-                        if (!string.IsNullOrEmpty(exception.Message))
-                        {
-                            var error = exception.Message.Replace(Environment.NewLine, " ");
-                            error = RemoveControlCharacters(error);
+                        var error = exception.Message.Replace(Environment.NewLine, " ");
+                        error = RemoveControlCharacters(error);
 
 
-                            res.AddHeader("X-Application-Error-Code", error);
-                        }
+                        res.AddHeader("X-Application-Error-Code", error);
                     }
                     }
+                }
 
 
-                    if (dto is CompressedResult)
-                    {
-                        // Per Google PageSpeed
-                        // This instructs the proxies to cache two versions of the resource: one compressed, and one uncompressed. 
-                        // The correct version of the resource is delivered based on the client request header. 
-                        // This is a good choice for applications that are singly homed and depend on public proxies for user locality.                        
-                        res.AddHeader("Vary", "Accept-Encoding");
-                    }
+                if (dto is CompressedResult)
+                {
+                    // Per Google PageSpeed
+                    // This instructs the proxies to cache two versions of the resource: one compressed, and one uncompressed. 
+                    // The correct version of the resource is delivered based on the client request header. 
+                    // This is a good choice for applications that are singly homed and depend on public proxies for user locality.                        
+                    res.AddHeader("Vary", "Accept-Encoding");
+                }
 
 
-                    var hasOptions = dto as IHasOptions;
+                var hasOptions = dto as IHasOptions;
 
 
-                    if (hasOptions != null)
+                if (hasOptions != null)
+                {
+                    // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy
+                    string contentLength;
+
+                    if (hasOptions.Options.TryGetValue("Content-Length", out contentLength) && !string.IsNullOrEmpty(contentLength))
                     {
                     {
-                        // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy
-                        string contentLength;
+                        var length = long.Parse(contentLength, UsCulture);
 
 
-                        if (hasOptions.Options.TryGetValue("Content-Length", out contentLength) && !string.IsNullOrEmpty(contentLength))
+                        if (length > 0)
                         {
                         {
-                            var length = long.Parse(contentLength, UsCulture);
-
-                            if (length > 0)
-                            {
-                                var response = (HttpListenerResponse) res.OriginalResponse;
+                            var response = (HttpListenerResponse)res.OriginalResponse;
 
 
-                                response.ContentLength64 = length;
+                            response.ContentLength64 = length;
 
 
-                                // Disable chunked encoding. Technically this is only needed when using Content-Range, but
-                                // anytime we know the content length there's no need for it
-                                response.SendChunked = false;
-                            }
+                            // Disable chunked encoding. Technically this is only needed when using Content-Range, but
+                            // anytime we know the content length there's no need for it
+                            response.SendChunked = false;
                         }
                         }
                     }
                     }
-                });
+                }
+            });
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 13 - 0
MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs

@@ -38,6 +38,11 @@ namespace MediaBrowser.Server.Implementations.IO
         /// </summary>
         /// </summary>
         private readonly ConcurrentDictionary<string,string> _tempIgnoredPaths = new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
         private readonly ConcurrentDictionary<string,string> _tempIgnoredPaths = new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
 
+        /// <summary>
+        /// Any file name ending in any of these will be ignored by the watchers
+        /// </summary>
+        private readonly List<string> _alwaysIgnoreFiles = new List<string> {"thumbs.db","small.jpg","albumart.jpg"}; 
+
         /// <summary>
         /// <summary>
         /// The timer lock
         /// The timer lock
         /// </summary>
         /// </summary>
@@ -313,10 +318,18 @@ namespace MediaBrowser.Server.Implementations.IO
         /// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param>
         /// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param>
         void watcher_Changed(object sender, FileSystemEventArgs e)
         void watcher_Changed(object sender, FileSystemEventArgs e)
         {
         {
+            // Ignore when someone manually creates a new folder
             if (e.ChangeType == WatcherChangeTypes.Created && e.Name == "New folder")
             if (e.ChangeType == WatcherChangeTypes.Created && e.Name == "New folder")
             {
             {
                 return;
                 return;
             }
             }
+
+            // Ignore certain files
+            if (_alwaysIgnoreFiles.Any(f => e.Name.EndsWith(f, StringComparison.OrdinalIgnoreCase)))
+            {
+                return;
+            }
+
             if (_tempIgnoredPaths.ContainsKey(e.FullPath))
             if (_tempIgnoredPaths.ContainsKey(e.FullPath))
             {
             {
                 Logger.Info("Watcher requested to ignore change to " + e.FullPath);
                 Logger.Info("Watcher requested to ignore change to " + e.FullPath);

+ 1 - 1
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -696,7 +696,7 @@ namespace MediaBrowser.Server.Implementations.Library
 
 
             var tasks = new List<Task>();
             var tasks = new List<Task>();
 
 
-            var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director };
+            var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director, PersonType.GuestStar };
 
 
             var people = RootFolder.RecursiveChildren
             var people = RootFolder.RecursiveChildren
                 .Where(c => c.People != null)
                 .Where(c => c.People != null)

+ 2 - 2
MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs

@@ -21,13 +21,13 @@ namespace MediaBrowser.WebDashboard.Api
         /// Gets or sets the plugin id.
         /// Gets or sets the plugin id.
         /// </summary>
         /// </summary>
         /// <value>The plugin id.</value>
         /// <value>The plugin id.</value>
-        public Guid PluginId { get; set; }
+        public string PluginId { get; set; }
 
 
         public ConfigurationPageInfo(IPluginConfigurationPage page)
         public ConfigurationPageInfo(IPluginConfigurationPage page)
         {
         {
             Name = page.Name;
             Name = page.Name;
             ConfigurationPageType = page.ConfigurationPageType;
             ConfigurationPageType = page.ConfigurationPageType;
-            PluginId = page.Plugin.Id;
+            PluginId = page.Plugin.Id.ToString();
         }
         }
     }
     }
 }
 }

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.72</version>
+        <version>3.0.75</version>
         <title>MediaBrowser.Common.Internal</title>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
         <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.72" />
+            <dependency id="MediaBrowser.Common" version="3.0.74" />
             <dependency id="NLog" version="2.0.0.2000" />
             <dependency id="NLog" version="2.0.0.2000" />
             <dependency id="ServiceStack.Text" version="3.9.38" />
             <dependency id="ServiceStack.Text" version="3.9.38" />
             <dependency id="protobuf-net" version="2.0.0.621" />
             <dependency id="protobuf-net" version="2.0.0.621" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common</id>
         <id>MediaBrowser.Common</id>
-        <version>3.0.72</version>
+        <version>3.0.75</version>
         <title>MediaBrowser.Common</title>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Server.Core</id>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.72</version>
+        <version>3.0.75</version>
         <title>Media Browser.Server.Core</title>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.72" />
+            <dependency id="MediaBrowser.Common" version="3.0.75" />
         </dependencies>
         </dependencies>
     </metadata>
     </metadata>
     <files>
     <files>