calculate item by name counts on the fly

This commit is contained in:
Luke Pulverenti
2014-03-09 18:14:44 -04:00
parent 1ead63b0d1
commit d494944767
49 changed files with 518 additions and 1197 deletions

View File

@@ -7,7 +7,6 @@ using MediaBrowser.Model.Querying;
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace MediaBrowser.Api.UserLibrary
@@ -81,10 +80,10 @@ namespace MediaBrowser.Api.UserLibrary
{
var user = UserManager.GetUserById(request.UserId.Value);
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
}
return DtoService.GetBaseItemDto(item, fields.ToList());
return DtoService.GetItemByNameDto(item, fields.ToList());
}
/// <summary>
@@ -115,19 +114,5 @@ namespace MediaBrowser.Api.UserLibrary
.Distinct()
.Select(year => LibraryManager.GetYear(year));
}
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
protected override IEnumerable<BaseItem> GetLibraryItems(Year item, IEnumerable<BaseItem> libraryItems)
{
int year;
if (!int.TryParse(item.Name, NumberStyles.Integer, UsCulture, out year))
{
return libraryItems;
}
return libraryItems.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year);
}
}
}