Merge pull request #2099 from MediaBrowser/dev

Dev
pull/702/head
Luke 8 years ago committed by GitHub
commit 259c5b9d44

@ -275,8 +275,6 @@ namespace MediaBrowser.Api.Reports
case ItemFilter.IsPlayed: case ItemFilter.IsPlayed:
query.IsPlayed = true; query.IsPlayed = true;
break; break;
case ItemFilter.IsRecentlyAdded:
break;
case ItemFilter.IsResumable: case ItemFilter.IsResumable:
query.IsResumable = true; query.IsResumable = true;
break; break;

@ -164,8 +164,6 @@ namespace MediaBrowser.Api.UserLibrary
case ItemFilter.IsPlayed: case ItemFilter.IsPlayed:
query.IsPlayed = true; query.IsPlayed = true;
break; break;
case ItemFilter.IsRecentlyAdded:
break;
case ItemFilter.IsResumable: case ItemFilter.IsResumable:
query.IsResumable = true; query.IsResumable = true;
break; break;

@ -149,24 +149,6 @@ namespace MediaBrowser.Api.UserLibrary
item = user == null ? _libraryManager.RootFolder : user.RootFolder; item = user == null ? _libraryManager.RootFolder : user.RootFolder;
} }
if (!string.IsNullOrEmpty(request.Ids))
{
var query = GetItemsQuery(request, user);
var specificItems = _libraryManager.GetItemList(query).ToArray();
if (query.SortBy.Length == 0)
{
var ids = query.ItemIds.ToList();
// Try to preserve order
specificItems = specificItems.OrderBy(i => ids.IndexOf(i.Id.ToString("N"))).ToArray();
}
return new QueryResult<BaseItem>
{
Items = specificItems.ToArray(),
TotalRecordCount = specificItems.Length
};
}
// Default list type = children // Default list type = children
var folder = item as Folder; var folder = item as Folder;
@ -289,8 +271,6 @@ namespace MediaBrowser.Api.UserLibrary
case ItemFilter.IsPlayed: case ItemFilter.IsPlayed:
query.IsPlayed = true; query.IsPlayed = true;
break; break;
case ItemFilter.IsRecentlyAdded:
break;
case ItemFilter.IsResumable: case ItemFilter.IsResumable:
query.IsResumable = true; query.IsResumable = true;
break; break;

@ -891,16 +891,16 @@ namespace MediaBrowser.Controller.Entities
{ {
if (query.ItemIds.Length > 0) if (query.ItemIds.Length > 0)
{ {
var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList(); var result = LibraryManager.GetItemsResult(query);
if (query.SortBy.Length == 0) if (query.SortBy.Length == 0)
{ {
var ids = query.ItemIds.ToList(); var ids = query.ItemIds.ToList();
// Try to preserve order // Try to preserve order
specificItems = specificItems.OrderBy(i => ids.IndexOf(i.Id.ToString("N"))).ToList(); result.Items = result.Items.OrderBy(i => ids.IndexOf(i.Id.ToString("N"))).ToArray();
} }
return Task.FromResult(PostFilterAndSort(specificItems, query, true, true)); return Task.FromResult(result);
} }
return GetItemsInternal(query); return GetItemsInternal(query);

@ -135,7 +135,11 @@ namespace MediaBrowser.Controller.Entities.TV
[IgnoreDataMember] [IgnoreDataMember]
public Series Series public Series Series
{ {
get { return FindParent<Series>(); } get
{
var seriesId = SeriesId ?? FindSeriesId();
return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
}
} }
[IgnoreDataMember] [IgnoreDataMember]
@ -143,24 +147,8 @@ namespace MediaBrowser.Controller.Entities.TV
{ {
get get
{ {
var season = FindParent<Season>(); var seasonId = SeasonId ?? FindSeasonId();
return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null;
// Episodes directly in series folder
if (season == null)
{
var series = Series;
if (series != null && ParentIndexNumber.HasValue)
{
var findNumber = ParentIndexNumber.Value;
season = series.Children
.OfType<Season>()
.FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == findNumber);
}
}
return season;
} }
} }
@ -193,7 +181,23 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid? FindSeasonId() public Guid? FindSeasonId()
{ {
var season = Season; var season = FindParent<Season>();
// Episodes directly in series folder
if (season == null)
{
var series = Series;
if (series != null && ParentIndexNumber.HasValue)
{
var findNumber = ParentIndexNumber.Value;
season = series.Children
.OfType<Season>()
.FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == findNumber);
}
}
return season == null ? (Guid?)null : season.Id; return season == null ? (Guid?)null : season.Id;
} }
@ -263,7 +267,7 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid? FindSeriesId() public Guid? FindSeriesId()
{ {
var series = Series; var series = FindParent<Series>();
return series == null ? (Guid?)null : series.Id; return series == null ? (Guid?)null : series.Id;
} }

@ -99,7 +99,11 @@ namespace MediaBrowser.Controller.Entities.TV
[IgnoreDataMember] [IgnoreDataMember]
public Series Series public Series Series
{ {
get { return FindParent<Series>(); } get
{
var seriesId = SeriesId ?? FindSeriesId();
return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null;
}
} }
[IgnoreDataMember] [IgnoreDataMember]
@ -241,7 +245,7 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid? FindSeriesId() public Guid? FindSeriesId()
{ {
var series = Series; var series = FindParent<Series>();
return series == null ? (Guid?)null : series.Id; return series == null ? (Guid?)null : series.Id;
} }

@ -27,10 +27,6 @@ namespace MediaBrowser.Model.Querying
/// </summary> /// </summary>
IsFavorite = 5, IsFavorite = 5,
/// <summary> /// <summary>
/// The is recently added
/// </summary>
IsRecentlyAdded = 6,
/// <summary>
/// The item is resumable /// The item is resumable
/// </summary> /// </summary>
IsResumable = 7, IsResumable = 7,

@ -203,12 +203,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// <returns>Video.</returns> /// <returns>Video.</returns>
protected override Video Resolve(ItemResolveArgs args) protected override Video Resolve(ItemResolveArgs args)
{ {
if (args.Path != null && args.Path.IndexOf("disney", StringComparison.OrdinalIgnoreCase) != -1)
{
var b = true;
var a = b;
}
var collectionType = args.GetCollectionType(); var collectionType = args.GetCollectionType();
if (IsInvalid(args.Parent, collectionType)) if (IsInvalid(args.Parent, collectionType))

Loading…
Cancel
Save