added IncludeIndexContainer

This commit is contained in:
Luke Pulverenti 2013-10-15 18:16:39 -04:00
parent dc986db8cc
commit 6a3b31a1b0
3 changed files with 31 additions and 6 deletions

View File

@ -179,6 +179,8 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "IsHD", Description = "Optional filter by items that are HD or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "IsHD", Description = "Optional filter by items that are HD or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsHD { get; set; } public bool? IsHD { get; set; }
public bool IncludeIndexContainers { get; set; }
} }
/// <summary> /// <summary>
@ -285,20 +287,37 @@ namespace MediaBrowser.Api.UserLibrary
var item = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : _dtoService.GetItemByDtoId(request.ParentId, user.Id); var item = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : _dtoService.GetItemByDtoId(request.ParentId, user.Id);
// Default list type = children // Default list type = children
IEnumerable<BaseItem> items;
if (!string.IsNullOrEmpty(request.Ids)) if (!string.IsNullOrEmpty(request.Ids))
{ {
var idList = request.Ids.Split(',').ToList(); var idList = request.Ids.Split(',').ToList();
return idList.Select(i => _dtoService.GetItemByDtoId(i, user.Id)); items = idList.Select(i => _dtoService.GetItemByDtoId(i, user.Id));
} }
if (request.Recursive) else if (request.Recursive)
{ {
return ((Folder)item).GetRecursiveChildren(user); items = ((Folder) item).GetRecursiveChildren(user);
}
else
{
items = ((Folder)item).GetChildren(user, true, request.IndexBy);
} }
return ((Folder)item).GetChildren(user, true, request.IndexBy); if (request.IncludeIndexContainers)
{
var list = items.ToList();
var containers = list.Select(i => i.IndexContainer)
.Where(i => i != null);
list.AddRange(containers);
return list.Distinct();
}
return items;
} }
/// <summary> /// <summary>
@ -648,7 +667,7 @@ namespace MediaBrowser.Api.UserLibrary
if (string.IsNullOrEmpty(personTypes)) if (string.IsNullOrEmpty(personTypes))
{ {
items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))); items = items.Where(item => item.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase)));
} }
else else
{ {

View File

@ -406,7 +406,7 @@ namespace MediaBrowser.Controller.Providers
return sb.ToString().GetMD5(); return sb.ToString().GetMD5();
} }
private static readonly Dictionary<string, string> FoldersToMonitor = new[] { "extrafanart" } private static readonly Dictionary<string, string> FoldersToMonitor = new[] { "extrafanart", "extrathumbs" }
.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); .ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
/// <summary> /// <summary>

View File

@ -229,6 +229,12 @@ namespace MediaBrowser.Model.Querying
/// </summary> /// </summary>
/// <value>The album artist starts with or greater.</value> /// <value>The album artist starts with or greater.</value>
public string AlbumArtistStartsWithOrGreater { get; set; } public string AlbumArtistStartsWithOrGreater { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [include index containers].
/// </summary>
/// <value><c>true</c> if [include index containers]; otherwise, <c>false</c>.</value>
public bool IncludeIndexContainers { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ItemQuery" /> class. /// Initializes a new instance of the <see cref="ItemQuery" /> class.