diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index 5bad7fe5d..f706a97c9 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -107,13 +107,6 @@ namespace MediaBrowser.Api dto.Type = item.GetType().Name; dto.UserRating = item.UserRating; - VirtualFolder virtualFolder = item.VirtualFolder; - - if (virtualFolder != null) - { - dto.VfType = virtualFolder.CollectionType; - } - dto.UserData = item.GetUserData(user); Folder folder = item as Folder; @@ -123,7 +116,7 @@ namespace MediaBrowser.Api dto.SpecialCounts = folder.GetSpecialCounts(user); dto.IsRoot = folder.IsRoot; - dto.IsVirtualFolder = folder is VirtualFolder; + dto.IsVirtualFolder = folder.Parent != null && folder.Parent.IsRoot; } Audio audio = item as Audio; diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 5359bdc91..ec7bf9c28 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -227,9 +227,40 @@ namespace MediaBrowser.Controller user.Name = "Default User"; user.Id = Guid.Parse("5d1cf7fce25943b790d140095457a42b"); + user.PrimaryImagePath = "D:\\Video\\TV\\Archer (2009)\\folder.jpg"; list.Add(user); + + user = new User(); + user.Name = "Test User 1"; + user.Id = Guid.NewGuid(); + list.Add(user); + user = new User(); + user.Name = "Test User 2"; + user.Id = Guid.NewGuid(); + list.Add(user); + + user = new User(); + user.Name = "Test User 3"; + user.Id = Guid.NewGuid(); + list.Add(user); + + user = new User(); + user.Name = "Test User 4"; + user.Id = Guid.NewGuid(); + list.Add(user); + + user = new User(); + user.Name = "Test User 5"; + user.Id = Guid.NewGuid(); + list.Add(user); + + user = new User(); + user.Name = "Test User 6"; + user.Id = Guid.NewGuid(); + list.Add(user); + return list; } diff --git a/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs b/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs index 0daca3b44..bace0ca49 100644 --- a/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs @@ -31,7 +31,7 @@ namespace MediaBrowser.Controller.Library { for (int i = 0; i < FileSystemChildren.Length; i++) { - if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase)) + if (FileSystemChildren[i].cFileName.Equals(name, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -42,15 +42,7 @@ namespace MediaBrowser.Controller.Library public bool ContainsFolder(string name) { - for (int i = 0; i < FileSystemChildren.Length; i++) - { - if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - - return false; + return ContainsFile(name); } } @@ -77,34 +69,6 @@ namespace MediaBrowser.Controller.Library } } - public VirtualFolder VirtualFolder - { - get - { - if (Parent != null) - { - return Parent.VirtualFolder; - } - - return null; - } - } - - public string VirtualFolderCollectionType - { - get - { - VirtualFolder vf = VirtualFolder; - - if (vf == null) - { - return null; - } - - return vf.CollectionType; - } - } - public bool IsHidden { get diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 5055ff1fc..d6f448ac6 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -77,7 +77,6 @@ - diff --git a/MediaBrowser.Controller/Resolvers/VirtualFolderResolver.cs b/MediaBrowser.Controller/Resolvers/VirtualFolderResolver.cs deleted file mode 100644 index e7940ef14..000000000 --- a/MediaBrowser.Controller/Resolvers/VirtualFolderResolver.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.ComponentModel.Composition; -using System.IO; -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.Controller.Resolvers -{ - [Export(typeof(IBaseItemResolver))] - public class VirtualFolderResolver : BaseFolderResolver - { - public override ResolverPriority Priority - { - get { return ResolverPriority.Third; } - } - - protected override VirtualFolder Resolve(ItemResolveEventArgs args) - { - if (args.IsDirectory && args.Parent != null && args.Parent.IsRoot) - { - return new VirtualFolder(); - } - - return null; - } - - protected override void SetInitialItemValues(VirtualFolder item, ItemResolveEventArgs args) - { - // Set the name initially by stripping off the [CollectionType=...] - // The name can always be overridden later by folder.xml - string pathName = Path.GetFileNameWithoutExtension(args.Path); - - string srch = "[collectiontype="; - int index = pathName.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase); - - if (index != -1) - { - item.Name = pathName.Substring(0, index).Trim(); - - item.CollectionType = pathName.Substring(index + srch.Length).TrimEnd(']'); - } - - base.SetInitialItemValues(item, args); - } - - } -} diff --git a/MediaBrowser.Model/DTO/DTOBaseItem.cs b/MediaBrowser.Model/DTO/DTOBaseItem.cs index 1251f4ec4..53d921d45 100644 --- a/MediaBrowser.Model/DTO/DTOBaseItem.cs +++ b/MediaBrowser.Model/DTO/DTOBaseItem.cs @@ -83,11 +83,6 @@ namespace MediaBrowser.Model.DTO public IEnumerable LocalTrailers { get; set; } public int LocalTrailerCount { get; set; } - /// - /// Holds the virtual folder collection type - /// - public string VfType { get; set; } - /// /// User data for this item based on the user it's being requested for /// diff --git a/MediaBrowser.Model/Entities/BaseItem.cs b/MediaBrowser.Model/Entities/BaseItem.cs index ef0ba01dc..8ab51ae33 100644 --- a/MediaBrowser.Model/Entities/BaseItem.cs +++ b/MediaBrowser.Model/Entities/BaseItem.cs @@ -6,29 +6,6 @@ namespace MediaBrowser.Model.Entities { public abstract class BaseItem : BaseEntity, IHasProviderIds { - /// - /// Goes up the tree to find the virtual folder parent - /// - public VirtualFolder VirtualFolder - { - get - { - var vf = this as VirtualFolder; - - if (vf != null) - { - return vf; - } - - if (Parent != null) - { - return Parent.VirtualFolder; - } - - return null; - } - } - public string SortName { get; set; } /// diff --git a/MediaBrowser.Model/Entities/VirtualFolder.cs b/MediaBrowser.Model/Entities/VirtualFolder.cs deleted file mode 100644 index f25db3e41..000000000 --- a/MediaBrowser.Model/Entities/VirtualFolder.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace MediaBrowser.Model.Entities -{ - public class VirtualFolder : Folder - { - public string CollectionType { get; set; } - } -} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index c341dd046..38acd3b03 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -48,7 +48,6 @@ - diff --git a/MediaBrowser.Movies/Resolvers/BoxSetResolver.cs b/MediaBrowser.Movies/Resolvers/BoxSetResolver.cs index 737ae1981..5e0e7488e 100644 --- a/MediaBrowser.Movies/Resolvers/BoxSetResolver.cs +++ b/MediaBrowser.Movies/Resolvers/BoxSetResolver.cs @@ -13,10 +13,9 @@ namespace MediaBrowser.Movies.Resolvers protected override BoxSet Resolve(ItemResolveEventArgs args) { // It's a boxset if all of the following conditions are met: - // It's under a 'Movies' VF // Is a Directory // Contains [boxset] in the path - if ((args.VirtualFolderCollectionType ?? string.Empty).Equals("Movies", StringComparison.OrdinalIgnoreCase) && args.IsDirectory) + if (args.IsDirectory) { if (Path.GetFileName(args.Path).IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1) { diff --git a/MediaBrowser.Movies/Resolvers/MovieResolver.cs b/MediaBrowser.Movies/Resolvers/MovieResolver.cs index 4058bb6a2..b343e21e4 100644 --- a/MediaBrowser.Movies/Resolvers/MovieResolver.cs +++ b/MediaBrowser.Movies/Resolvers/MovieResolver.cs @@ -1,5 +1,4 @@ -using System; -using System.ComponentModel.Composition; +using System.ComponentModel.Composition; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; @@ -14,8 +13,17 @@ namespace MediaBrowser.Movies.Resolvers protected override Movie Resolve(ItemResolveEventArgs args) { // Must be a directory and under a 'Movies' VF - if ((args.VirtualFolderCollectionType ?? string.Empty).Equals("Movies", StringComparison.OrdinalIgnoreCase) && args.IsDirectory) + if (args.IsDirectory) { + // If the parent is not a boxset, the only other allowed parent type is Folder + if (!(args.Parent is BoxSet)) + { + if (args.Parent != null && args.Parent.GetType() != typeof(Folder)) + { + return null; + } + } + // Return a movie if the video resolver finds something in the folder return GetMovie(args); } @@ -73,25 +81,5 @@ namespace MediaBrowser.Movies.Resolvers return null; } - - /*private void PopulateBonusFeatures(Movie item, ItemResolveEventArgs args) - { - if (args.ContainsFolder("specials")) - { - List