diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index bef0ba1e19..843e39f784 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -85,7 +85,7 @@ namespace MediaBrowser.Api.Library
{
allTypes = allTypes.Where(t =>
{
- if (t == typeof(UserRootFolder) || t == typeof(AggregateFolder) || t == typeof(Folder) || t == typeof(IndexFolder) || t == typeof(CollectionFolder) || t == typeof(Year))
+ if (t == typeof(UserRootFolder) || t == typeof(AggregateFolder) || t == typeof(Folder) || t == typeof(CollectionFolder) || t == typeof(Year))
{
return false;
}
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index dc4a833b0e..c1ab50e281 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -52,12 +52,6 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "SearchTerm", Description = "Optional. If specified, results will be filtered based on a search term.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SearchTerm { get; set; }
- ///
- /// The dynamic, localized index function name
- ///
- /// The index by.
- public string IndexBy { get; set; }
-
///
/// Limit results to items containing specific genres
///
@@ -358,7 +352,7 @@ namespace MediaBrowser.Api.UserLibrary
}
else
{
- items = ((Folder)item).GetChildren(user, true, request.IndexBy);
+ items = ((Folder)item).GetChildren(user, true);
}
if (request.IncludeIndexContainers)
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index f032d9318a..351385533f 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -58,13 +58,6 @@ namespace MediaBrowser.Controller.Entities
/// Task.
protected override Task ValidateChildrenInternal(IProgress progress, CancellationToken cancellationToken, bool? recursive = null, bool forceRefreshMetadata = false)
{
- //we don't directly validate our children
- //but we do need to clear out the index cache...
- if (IndexCache != null)
- {
- IndexCache.Clear();
- }
-
ResetDynamicChildren();
return NullTaskResult;
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 1d38b37281..8ef86e54e7 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -208,284 +208,25 @@ namespace MediaBrowser.Controller.Entities
#region Indexing
- ///
- /// The _index by options
- ///
- private Dictionary>> _indexByOptions;
- ///
- /// Dictionary of index options - consists of a display value and an indexing function
- /// which takes User as a parameter and returns an IEnum of BaseItem
- ///
- /// The index by options.
- [IgnoreDataMember]
- public Dictionary>> IndexByOptions
- {
- get { return _indexByOptions ?? (_indexByOptions = GetIndexByOptions()); }
- }
-
///
/// Returns the valid set of index by options for this folder type.
/// Override or extend to modify.
///
/// Dictionary{System.StringFunc{UserIEnumerable{BaseItem}}}.
- protected virtual Dictionary>> GetIndexByOptions()
+ protected virtual IEnumerable GetIndexByOptions()
{
- return new Dictionary>> {
- {LocalizedStrings.Instance.GetString("NoneDispPref"), null},
- {LocalizedStrings.Instance.GetString("PerformerDispPref"), GetIndexByPerformer},
- {LocalizedStrings.Instance.GetString("GenreDispPref"), GetIndexByGenre},
- {LocalizedStrings.Instance.GetString("DirectorDispPref"), GetIndexByDirector},
- {LocalizedStrings.Instance.GetString("YearDispPref"), GetIndexByYear},
+ return new List {
+ {LocalizedStrings.Instance.GetString("NoneDispPref")},
+ {LocalizedStrings.Instance.GetString("PerformerDispPref")},
+ {LocalizedStrings.Instance.GetString("GenreDispPref")},
+ {LocalizedStrings.Instance.GetString("DirectorDispPref")},
+ {LocalizedStrings.Instance.GetString("YearDispPref")},
//{LocalizedStrings.Instance.GetString("OfficialRatingDispPref"), null},
- {LocalizedStrings.Instance.GetString("StudioDispPref"), GetIndexByStudio}
+ {LocalizedStrings.Instance.GetString("StudioDispPref")}
};
}
- ///
- /// Gets the index by actor.
- ///
- /// The user.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GetIndexByPerformer(User user)
- {
- return GetIndexByPerson(user, new List { PersonType.Actor, PersonType.GuestStar }, true, LocalizedStrings.Instance.GetString("PerformerDispPref"));
- }
-
- ///
- /// Gets the index by director.
- ///
- /// The user.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GetIndexByDirector(User user)
- {
- return GetIndexByPerson(user, new List { PersonType.Director }, false, LocalizedStrings.Instance.GetString("DirectorDispPref"));
- }
-
- ///
- /// Gets the index by person.
- ///
- /// The user.
- /// The person types we should match on
- /// if set to true [include audio].
- /// Name of the index.
- /// IEnumerable{BaseItem}.
- private IEnumerable GetIndexByPerson(User user, List personTypes, bool includeAudio, string indexName)
- {
- // Even though this implementation means multiple iterations over the target list - it allows us to defer
- // the retrieval of the individual children for each index value until they are requested.
- using (new Profiler(indexName + " Index Build for " + Name, Logger))
- {
- // Put this in a local variable to avoid an implicitly captured closure
- var currentIndexName = indexName;
-
- var us = this;
- var recursiveChildren = GetRecursiveChildren(user).Where(i => i.IncludeInIndex).ToList();
-
- // Get the candidates, but handle audio separately
- var candidates = recursiveChildren.Where(i => i.AllPeople != null && !(i is Audio.Audio)).ToList();
-
- var indexFolders = candidates.AsParallel().SelectMany(i => i.AllPeople.Where(p => personTypes.Contains(p.Type))
- .Select(a => a.Name))
- .Distinct()
- .Select(i =>
- {
- try
- {
- return LibraryManager.GetPerson(i);
- }
- catch (IOException ex)
- {
- Logger.ErrorException("Error getting person {0}", ex, i);
- return null;
- }
- catch (AggregateException ex)
- {
- Logger.ErrorException("Error getting person {0}", ex, i);
- return null;
- }
- })
- .Where(i => i != null)
- .Select(a => new IndexFolder(us, a,
- candidates.Where(i => i.AllPeople.Any(p => personTypes.Contains(p.Type) && p.Name.Equals(a.Name, StringComparison.OrdinalIgnoreCase))
- ), currentIndexName)).AsEnumerable();
-
- if (includeAudio)
- {
- var songs = recursiveChildren.OfType().ToList();
-
- indexFolders = songs.SelectMany(i => i.Artists)
- .Distinct(StringComparer.OrdinalIgnoreCase)
- .Select(i =>
- {
- try
- {
- return LibraryManager.GetArtist(i);
- }
- catch (IOException ex)
- {
- Logger.ErrorException("Error getting artist {0}", ex, i);
- return null;
- }
- catch (AggregateException ex)
- {
- Logger.ErrorException("Error getting artist {0}", ex, i);
- return null;
- }
- })
- .Where(i => i != null)
- .Select(a => new IndexFolder(us, a,
- songs.Where(i => i.Artists.Contains(a.Name, StringComparer.OrdinalIgnoreCase)
- ), currentIndexName)).Concat(indexFolders);
- }
-
- return indexFolders;
- }
- }
-
- ///
- /// Gets the index by studio.
- ///
- /// The user.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GetIndexByStudio(User user)
- {
- // Even though this implementation means multiple iterations over the target list - it allows us to defer
- // the retrieval of the individual children for each index value until they are requested.
- using (new Profiler("Studio Index Build for " + Name, Logger))
- {
- var indexName = LocalizedStrings.Instance.GetString("StudioDispPref");
-
- var candidates = GetRecursiveChildren(user).Where(i => i.IncludeInIndex).ToList();
-
- return candidates.AsParallel().SelectMany(i => i.AllStudios)
- .Distinct()
- .Select(i =>
- {
- try
- {
- return LibraryManager.GetStudio(i);
- }
- catch (IOException ex)
- {
- Logger.ErrorException("Error getting studio {0}", ex, i);
- return null;
- }
- catch (AggregateException ex)
- {
- Logger.ErrorException("Error getting studio {0}", ex, i);
- return null;
- }
- })
- .Where(i => i != null)
- .Select(ndx => new IndexFolder(this, ndx, candidates.Where(i => i.AllStudios.Any(s => s.Equals(ndx.Name, StringComparison.OrdinalIgnoreCase))), indexName));
- }
- }
-
- ///
- /// Gets the index by genre.
- ///
- /// The user.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GetIndexByGenre(User user)
- {
- // Even though this implementation means multiple iterations over the target list - it allows us to defer
- // the retrieval of the individual children for each index value until they are requested.
- using (new Profiler("Genre Index Build for " + Name, Logger))
- {
- var indexName = LocalizedStrings.Instance.GetString("GenreDispPref");
-
- //we need a copy of this so we don't double-recurse
- var candidates = GetRecursiveChildren(user).Where(i => i.IncludeInIndex).ToList();
-
- return candidates.AsParallel().SelectMany(i => i.AllGenres)
- .Distinct(StringComparer.OrdinalIgnoreCase)
- .Select(i =>
- {
- try
- {
- return LibraryManager.GetGenre(i);
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error getting genre {0}", ex, i);
- return null;
- }
- })
- .Where(i => i != null)
- .Select(genre => new IndexFolder(this, genre, candidates.Where(i => i.AllGenres.Any(g => g.Equals(genre.Name, StringComparison.OrdinalIgnoreCase))), indexName)
- );
- }
- }
-
- ///
- /// Gets the index by year.
- ///
- /// The user.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GetIndexByYear(User user)
- {
- // Even though this implementation means multiple iterations over the target list - it allows us to defer
- // the retrieval of the individual children for each index value until they are requested.
- using (new Profiler("Production Year Index Build for " + Name, Logger))
- {
- var indexName = LocalizedStrings.Instance.GetString("YearDispPref");
-
- //we need a copy of this so we don't double-recurse
- var candidates = GetRecursiveChildren(user).Where(i => i.IncludeInIndex && i.ProductionYear.HasValue).ToList();
-
- return candidates.AsParallel().Select(i => i.ProductionYear.Value)
- .Distinct()
- .Select(i =>
- {
- try
- {
- return LibraryManager.GetYear(i);
- }
- catch (IOException ex)
- {
- Logger.ErrorException("Error getting year {0}", ex, i);
- return null;
- }
- catch (AggregateException ex)
- {
- Logger.ErrorException("Error getting year {0}", ex, i);
- return null;
- }
- })
- .Where(i => i != null)
-
- .Select(ndx => new IndexFolder(this, ndx, candidates.Where(i => i.ProductionYear == int.Parse(ndx.Name)), indexName));
-
- }
- }
-
- ///
- /// Returns the indexed children for this user from the cache. Caches them if not already there.
- ///
- /// The user.
- /// The index by.
- /// IEnumerable{BaseItem}.
- private IEnumerable GetIndexedChildren(User user, string indexBy)
- {
- List result = null;
- var cacheKey = user.Name + indexBy;
-
- if (IndexCache != null)
- {
- IndexCache.TryGetValue(cacheKey, out result);
- }
-
- if (result == null)
- {
- //not cached - cache it
- Func> indexing;
- IndexByOptions.TryGetValue(indexBy, out indexing);
- result = BuildIndex(indexBy, indexing, user);
- }
- return result;
- }
-
///
/// Get the list of indexy by choices for this folder (localized).
///
@@ -493,31 +234,7 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public IEnumerable IndexByOptionStrings
{
- get { return IndexByOptions.Keys; }
- }
-
- ///
- /// The index cache
- ///
- protected ConcurrentDictionary> IndexCache;
-
- ///
- /// Builds the index.
- ///
- /// The index key.
- /// The index function.
- /// The user.
- /// List{BaseItem}.
- protected virtual List BuildIndex(string indexKey, Func> indexFunction, User user)
- {
- if (IndexCache == null)
- {
- IndexCache = new ConcurrentDictionary>();
- }
-
- return indexFunction != null
- ? IndexCache[user.Name + indexKey] = indexFunction(user).ToList()
- : null;
+ get { return GetIndexByOptions(); }
}
#endregion
@@ -765,12 +482,6 @@ namespace MediaBrowser.Controller.Entities
AddChildrenInternal(newItems);
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
-
- //force the indexes to rebuild next time
- if (IndexCache != null)
- {
- IndexCache.Clear();
- }
}
progress.Report(10);
@@ -988,10 +699,9 @@ namespace MediaBrowser.Controller.Entities
///
/// The user.
/// if set to true [include linked children].
- /// The index by.
/// IEnumerable{BaseItem}.
///
- public virtual IEnumerable GetChildren(User user, bool includeLinkedChildren, string indexBy = null)
+ public virtual IEnumerable GetChildren(User user, bool includeLinkedChildren)
{
if (user == null)
{
@@ -999,19 +709,7 @@ namespace MediaBrowser.Controller.Entities
}
//the true root should return our users root folder children
- if (IsPhysicalRoot) return user.RootFolder.GetChildren(user, includeLinkedChildren, indexBy);
-
- IEnumerable result = null;
-
- if (!string.IsNullOrEmpty(indexBy))
- {
- result = GetIndexedChildren(user, indexBy);
- }
-
- if (result != null)
- {
- return result;
- }
+ if (IsPhysicalRoot) return user.RootFolder.GetChildren(user, includeLinkedChildren);
var list = new List();
diff --git a/MediaBrowser.Controller/Entities/IndexFolder.cs b/MediaBrowser.Controller/Entities/IndexFolder.cs
deleted file mode 100644
index 57e4a35d3f..0000000000
--- a/MediaBrowser.Controller/Entities/IndexFolder.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Model.Entities;
-using MoreLinq;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Controller.Entities
-{
- ///
- /// Class IndexFolder
- ///
- public class IndexFolder : Folder
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The parent.
- /// The shadow.
- /// The children.
- /// Name of the index.
- /// if set to true [group contents].
- public IndexFolder(Folder parent, BaseItem shadow, IEnumerable children, string indexName, bool groupContents = true)
- {
- ChildSource = children;
- ShadowItem = shadow;
- GroupContents = groupContents;
- if (shadow == null)
- {
- Name = ForcedSortName = "";
- }
- else
- {
- SetShadowValues();
- }
- Id = (parent.Id.ToString() + Name).GetMBId(typeof(IndexFolder));
-
- IndexName = indexName;
- Parent = parent;
- }
-
- ///
- /// Resets the parent.
- ///
- /// The parent.
- public void ResetParent(Folder parent)
- {
- Parent = parent;
- Id = (parent.Id.ToString() + Name).GetMBId(typeof(IndexFolder));
- }
-
- ///
- /// Override this to true if class should be grouped under a container in indicies
- /// The container class should be defined via IndexContainer
- ///
- /// true if [group in index]; otherwise, false.
- [IgnoreDataMember]
- public override bool GroupInIndex
- {
- get
- {
- return ShadowItem != null && ShadowItem.GroupInIndex;
- }
- }
-
- public override LocationType LocationType
- {
- get
- {
- return LocationType.Virtual;
- }
- }
-
- ///
- /// Override this to return the folder that should be used to construct a container
- /// for this item in an index. GroupInIndex should be true as well.
- ///
- /// The index container.
- [IgnoreDataMember]
- public override Folder IndexContainer
- {
- get { return ShadowItem != null ? ShadowItem.IndexContainer : new IndexFolder(this, null, null, "", false); }
- }
-
- ///
- /// Gets or sets a value indicating whether [group contents].
- ///
- /// true if [group contents]; otherwise, false.
- protected bool GroupContents { get; set; }
- ///
- /// Gets or sets the child source.
- ///
- /// The child source.
- protected IEnumerable ChildSource { get; set; }
- ///
- /// Gets or sets our children.
- ///
- /// Our children.
- protected ConcurrentBag OurChildren { get; set; }
- ///
- /// Gets the name of the index.
- ///
- /// The name of the index.
- public string IndexName { get; private set; }
-
- ///
- /// Override to return the children defined to us when we were created
- ///
- /// The actual children.
- protected override IEnumerable LoadChildren()
- {
- var originalChildSource = ChildSource.ToList();
-
- var kids = originalChildSource;
- if (GroupContents)
- {
- // Recursively group up the chain
- var group = true;
- var isSubsequentLoop = false;
-
- while (group)
- {
- kids = isSubsequentLoop || kids.Any(i => i.GroupInIndex)
- ? GroupedSource(kids).ToList()
- : originalChildSource;
-
- group = kids.Any(i => i.GroupInIndex);
- isSubsequentLoop = true;
- }
- }
-
- // Now - since we built the index grouping from the bottom up - we now need to properly set Parents from the top down
- SetParents(this, kids.OfType());
-
- return kids.DistinctBy(i => i.Id);
- }
-
- ///
- /// Sets the parents.
- ///
- /// The parent.
- /// The kids.
- private void SetParents(Folder parent, IEnumerable kids)
- {
- foreach (var child in kids)
- {
- child.ResetParent(parent);
- child.SetParents(child, child.Children.OfType());
- }
- }
-
- ///
- /// Groupeds the source.
- ///
- /// The source.
- /// IEnumerable{BaseItem}.
- protected IEnumerable GroupedSource(IEnumerable source)
- {
- return source.GroupBy(i => i.IndexContainer).Select(container => new IndexFolder(this, container.Key, container, null, false));
- }
-
- ///
- /// The item we are shadowing as a folder (Genre, Actor, etc.)
- /// We inherit the images and other meta from this item
- ///
- /// The shadow item.
- protected BaseItem ShadowItem { get; set; }
-
- ///
- /// Sets the shadow values.
- ///
- protected void SetShadowValues()
- {
- if (ShadowItem != null)
- {
- Name = ShadowItem.Name;
- ForcedSortName = ShadowItem.SortName;
- Genres = ShadowItem.Genres;
- Studios = ShadowItem.Studios;
- OfficialRating = ShadowItem.OfficialRatingForComparison;
- BackdropImagePaths = ShadowItem.BackdropImagePaths;
- Images = ShadowItem.Images;
- Overview = ShadowItem.Overview;
- DisplayMediaType = ShadowItem.GetType().Name;
- }
- }
-
- ///
- /// Overrides the base implementation to refresh metadata for local trailers
- ///
- /// The cancellation token.
- /// if set to true [is new item].
- /// if set to true [force].
- /// if set to true [allow slow providers].
- /// if set to true [reset resolve args].
- /// Task{System.Boolean}.
- public override Task RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
- {
- // We should never get in here since these are not part of the library
- return Task.FromResult(false);
- }
- }
-}
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 3a767421a6..a53bb53f1e 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -57,13 +57,13 @@ namespace MediaBrowser.Controller.Entities.TV
}
// Genre, Rating and Stuido will all be the same
- protected override Dictionary>> GetIndexByOptions()
+ protected override IEnumerable GetIndexByOptions()
{
- return new Dictionary>> {
- {LocalizedStrings.Instance.GetString("NoneDispPref"), null},
- {LocalizedStrings.Instance.GetString("PerformerDispPref"), GetIndexByPerformer},
- {LocalizedStrings.Instance.GetString("DirectorDispPref"), GetIndexByDirector},
- {LocalizedStrings.Instance.GetString("YearDispPref"), GetIndexByYear},
+ return new List {
+ {LocalizedStrings.Instance.GetString("NoneDispPref")},
+ {LocalizedStrings.Instance.GetString("PerformerDispPref")},
+ {LocalizedStrings.Instance.GetString("DirectorDispPref")},
+ {LocalizedStrings.Instance.GetString("YearDispPref")},
};
}
@@ -240,7 +240,7 @@ namespace MediaBrowser.Controller.Entities.TV
.Cast();
}
- public override IEnumerable GetChildren(User user, bool includeLinkedChildren, string indexBy = null)
+ public override IEnumerable GetChildren(User user, bool includeLinkedChildren)
{
return GetEpisodes(user);
}
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index b8adc65818..c48b44d91f 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -89,13 +89,13 @@ namespace MediaBrowser.Controller.Entities.TV
}
// Studio, Genre and Rating will all be the same so makes no sense to index by these
- protected override Dictionary>> GetIndexByOptions()
+ protected override IEnumerable GetIndexByOptions()
{
- return new Dictionary>> {
- {LocalizedStrings.Instance.GetString("NoneDispPref"), null},
- {LocalizedStrings.Instance.GetString("PerformerDispPref"), GetIndexByPerformer},
- {LocalizedStrings.Instance.GetString("DirectorDispPref"), GetIndexByDirector},
- {LocalizedStrings.Instance.GetString("YearDispPref"), GetIndexByYear},
+ return new List {
+ {LocalizedStrings.Instance.GetString("NoneDispPref")},
+ {LocalizedStrings.Instance.GetString("PerformerDispPref")},
+ {LocalizedStrings.Instance.GetString("DirectorDispPref")},
+ {LocalizedStrings.Instance.GetString("YearDispPref")},
};
}
@@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
- public override IEnumerable GetChildren(User user, bool includeLinkedChildren, string indexBy = null)
+ public override IEnumerable GetChildren(User user, bool includeLinkedChildren)
{
return GetSeasons(user);
}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 8d03f84807..b3b0f06c32 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -147,7 +147,6 @@
-
diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs
index 6602e031f5..afc0540ef4 100644
--- a/MediaBrowser.Model/Querying/ItemQuery.cs
+++ b/MediaBrowser.Model/Querying/ItemQuery.cs
@@ -140,12 +140,6 @@ namespace MediaBrowser.Model.Querying
/// The index by.
public string SearchTerm { get; set; }
- ///
- /// The dynamic, localized index function name
- ///
- /// The index by.
- public string IndexBy { get; set; }
-
///
/// Gets or sets the image types.
///
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index faa9b0e619..14496d362c 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -292,8 +292,6 @@ namespace MediaBrowser.Server.Implementations.Dto
return info;
}
- const string IndexFolderDelimeter = "-index-";
-
///
/// Gets client-side Id of a server-side BaseItem
///
@@ -307,13 +305,6 @@ namespace MediaBrowser.Server.Implementations.Dto
throw new ArgumentNullException("item");
}
- var indexFolder = item as IndexFolder;
-
- if (indexFolder != null)
- {
- return GetDtoId(indexFolder.Parent) + IndexFolderDelimeter + (indexFolder.IndexName ?? string.Empty) + IndexFolderDelimeter + indexFolder.Id;
- }
-
return item.Id.ToString("N");
}
@@ -618,26 +609,15 @@ namespace MediaBrowser.Server.Implementations.Dto
throw new ArgumentNullException("id");
}
- // If the item is an indexed folder we have to do a special routine to get it
- var isIndexFolder = id.IndexOf(IndexFolderDelimeter, StringComparison.OrdinalIgnoreCase) != -1;
-
- if (isIndexFolder)
- {
- if (userId.HasValue)
- {
- return GetIndexFolder(id, userId.Value);
- }
- }
-
BaseItem item = null;
- if (userId.HasValue || !isIndexFolder)
+ if (userId.HasValue)
{
item = _libraryManager.GetItemById(new Guid(id));
}
// If we still don't find it, look within individual user views
- if (item == null && !userId.HasValue && isIndexFolder)
+ if (item == null && !userId.HasValue)
{
foreach (var user in _userManager.Users)
{
@@ -653,60 +633,6 @@ namespace MediaBrowser.Server.Implementations.Dto
return item;
}
- ///
- /// Finds an index folder based on an Id and userId
- ///
- /// The id.
- /// The user id.
- /// BaseItem.
- private BaseItem GetIndexFolder(string id, Guid userId)
- {
- var user = _userManager.GetUserById(userId);
-
- var stringSeparators = new[] { IndexFolderDelimeter };
-
- // Split using the delimeter
- var values = id.Split(stringSeparators, StringSplitOptions.None).ToList();
-
- // Get the top folder normally using the first id
- var folder = GetItemByDtoId(values[0], userId) as Folder;
-
- values.RemoveAt(0);
-
- // Get indexed folders using the remaining values in the id string
- return GetIndexFolder(values, folder, user);
- }
-
- ///
- /// Gets indexed folders based on a list of index names and folder id's
- ///
- /// The values.
- /// The parent folder.
- /// The user.
- /// BaseItem.
- private BaseItem GetIndexFolder(List values, Folder parentFolder, User user)
- {
- // The index name is first
- var indexBy = values[0];
-
- // The index folder id is next
- var indexFolderId = new Guid(values[1]);
-
- // Remove them from the lst
- values.RemoveRange(0, 2);
-
- // Get the IndexFolder
- var indexFolder = parentFolder.GetChildren(user, false, indexBy).FirstOrDefault(i => i.Id == indexFolderId) as Folder;
-
- // Nested index folder
- if (values.Count > 0)
- {
- return GetIndexFolder(values, indexFolder, user);
- }
-
- return indexFolder;
- }
-
///
/// Sets simple property values on a DTOBaseItem
///
diff --git a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
index c133e09571..6d6157fa76 100644
--- a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
+++ b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs
@@ -100,7 +100,7 @@ namespace MediaBrowser.ServerApplication
var prefs = ddlProfile.SelectedItem != null ? _displayPreferencesManager.GetDisplayPreferences(currentFolder.DisplayPreferencesId, (ddlProfile.SelectedItem as User).Id, "LibraryExplorer") ?? new DisplayPreferences { SortBy = ItemSortBy.SortName } : new DisplayPreferences { SortBy = ItemSortBy.SortName };
var node = new TreeViewItem { Tag = currentFolder };
- var subChildren = currentFolder.GetChildren(CurrentUser, true, prefs.IndexBy);
+ var subChildren = currentFolder.GetChildren(CurrentUser, true);
subChildren = OrderByName(subChildren, CurrentUser);
AddChildren(node, subChildren, CurrentUser);
node.Header = currentFolder.Name + " (" +
@@ -371,7 +371,7 @@ namespace MediaBrowser.ServerApplication
//re-build the current item's children as an index
prefs.IndexBy = ddlIndexBy.SelectedItem as string;
treeItem.Items.Clear();
- AddChildren(treeItem, OrderBy(folder.GetChildren(CurrentUser, true, prefs.IndexBy), CurrentUser, prefs.SortBy), CurrentUser);
+ AddChildren(treeItem, OrderBy(folder.GetChildren(CurrentUser, true), CurrentUser, prefs.SortBy), CurrentUser);
treeItem.Header = folder.Name + "(" +
treeItem.Items.Count + ")";
Cursor = Cursors.Arrow;
@@ -412,7 +412,7 @@ namespace MediaBrowser.ServerApplication
//re-sort
prefs.SortBy = ddlSortBy.SelectedItem as string;
treeItem.Items.Clear();
- AddChildren(treeItem, OrderBy(folder.GetChildren(CurrentUser, true, prefs.IndexBy), CurrentUser, prefs.SortBy ?? ItemSortBy.SortName), CurrentUser);
+ AddChildren(treeItem, OrderBy(folder.GetChildren(CurrentUser, true), CurrentUser, prefs.SortBy ?? ItemSortBy.SortName), CurrentUser);
treeItem.Header = folder.Name + "(" +
treeItem.Items.Count + ")";
Cursor = Cursors.Arrow;