sync fixes

This commit is contained in:
Luke Pulverenti 2016-02-26 01:38:29 -05:00
parent 2c3113ced7
commit 78f5152ddb
3 changed files with 59 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Providers;
using System;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Users;
@ -6,6 +7,7 @@ using MoreLinq;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Entities.TV
@ -127,6 +129,30 @@ namespace MediaBrowser.Controller.Entities.TV
get { return (IndexNumber ?? -1) == 0; }
}
public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
IEnumerable<BaseItem> items;
if (query.User == null)
{
items = query.Recursive
? GetRecursiveChildren(filter)
: Children.Where(filter);
}
else
{
items = GetEpisodes(query.User).Where(filter);
}
var result = PostFilterAndSort(items, query);
return Task.FromResult(result);
}
/// <summary>
/// Gets the episodes.
/// </summary>

View File

@ -157,6 +157,32 @@ namespace MediaBrowser.Controller.Entities.TV
return GetSeasons(user, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes);
}
public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
IEnumerable<BaseItem> items;
if (query.User == null)
{
items = query.Recursive
? GetRecursiveChildren(filter)
: Children.Where(filter);
}
else
{
items = query.Recursive
? GetRecursiveChildren(user, filter)
: GetSeasons(user).Where(filter);
}
var result = PostFilterAndSort(items, query);
return Task.FromResult(result);
}
public IEnumerable<Season> GetSeasons(User user, bool includeMissingSeasons, bool includeVirtualUnaired)
{
var seasons = base.GetChildren(user, true)

View File

@ -338,6 +338,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return series.GetEpisodes(user, false, false);
}
var season = item as Season;
if (season != null)
{
return season.GetEpisodes(user, false, false);
}
if (item.IsFolder)
{
var folder = (Folder)item;