aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-10 15:20:17 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-05-10 15:20:17 -0400
commit9a730263896a648b3ec7af10d591ea4113842dcb (patch)
treedc2629fc19a482e1b5322dc0abf088551117b8bc /MediaBrowser.Server.Implementations/Library
parent3dc494c02d125a17770f286cf5fe2aad5b56ef38 (diff)
update item counts
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs11
-rw-r--r--MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs15
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/YearsPostScanTask.cs12
3 files changed, 22 insertions, 16 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index ec62e733b..0c342986f 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -306,9 +306,14 @@ namespace MediaBrowser.Server.Implementations.Library
/// <returns>Task.</returns>
private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken)
{
- var seasons = RootFolder.GetRecursiveChildren(i => i is Season)
- .Cast<Season>()
- .Where(i => i.IndexNumber.HasValue && i.IndexNumber.Value == 0 && !string.Equals(i.Name, newName, StringComparison.Ordinal))
+ var seasons = GetItemList(new InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { typeof(Season).Name },
+ Recursive = true,
+ IndexNumber = 0
+
+ }).Cast<Season>()
+ .Where(i => !string.Equals(i.Name, newName, StringComparison.Ordinal))
.ToList();
foreach (var season in seasons)
diff --git a/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs
index 5fc9c3168..78107b82d 100644
--- a/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs
+++ b/MediaBrowser.Server.Implementations/Library/LocalTrailerPostScanTask.cs
@@ -6,6 +6,8 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Entities.Movies;
+using MediaBrowser.Controller.Entities.TV;
namespace MediaBrowser.Server.Implementations.Library
{
@@ -22,10 +24,12 @@ namespace MediaBrowser.Server.Implementations.Library
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder
- .GetRecursiveChildren(i => i is IHasTrailers)
- .Cast<IHasTrailers>()
- .ToList();
+ var items = _libraryManager.GetItemList(new InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { typeof(BoxSet).Name, typeof(Game).Name, typeof(Movie).Name, typeof(Series).Name },
+ Recursive = true
+
+ }).OfType<IHasTrailers>().ToList();
var trailerTypes = Enum.GetNames(typeof(TrailerType))
.Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true))
@@ -35,7 +39,8 @@ namespace MediaBrowser.Server.Implementations.Library
var trailers = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Trailer).Name },
- TrailerTypes = trailerTypes
+ TrailerTypes = trailerTypes,
+ Recursive = true
}).ToArray();
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/YearsPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/YearsPostScanTask.cs
index 5ea5fb254..6a827d7a3 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/YearsPostScanTask.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/YearsPostScanTask.cs
@@ -20,16 +20,12 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var allYears = _libraryManager.RootFolder.GetRecursiveChildren(i => i.ProductionYear.HasValue)
- .Select(i => i.ProductionYear ?? -1)
- .Where(i => i > 0)
- .Distinct()
- .ToList();
-
- var count = allYears.Count;
+ var yearNumber = 1900;
+ var maxYear = DateTime.UtcNow.Year + 3;
+ var count = maxYear - yearNumber + 1;
var numComplete = 0;
- foreach (var yearNumber in allYears)
+ while (yearNumber < DateTime.UtcNow.Year + 3)
{
try
{