diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-14 15:03:35 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-14 15:03:35 -0500 |
| commit | f4b890f163cd3be5b399ef03be409106ab8ff60b (patch) | |
| tree | 5142c6f6772b39582922d637a94f5953db9b0158 /MediaBrowser.Api/UserLibrary/YearsService.cs | |
| parent | 3cde2011904de6a874b17cab97fbc984ce62c228 (diff) | |
added new item by name filters
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/YearsService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/YearsService.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index 8f5178ac5..8b03fb50b 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -114,5 +114,19 @@ 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); + } } } |
