update item counts
This commit is contained in:
parent
3dc494c02d
commit
9a73026389
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Genres = new[] { Name };
|
query.Genres = new[] { Name };
|
||||||
query.ExcludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
query.IncludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
||||||
|
|
||||||
return LibraryManager.GetItemList(query);
|
return LibraryManager.GetItemList(query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,24 +194,13 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
|
|
||||||
private List<BaseItem> GetTaggedItems(IItemByName byName, User user)
|
private List<BaseItem> GetTaggedItems(IItemByName byName, User user)
|
||||||
{
|
{
|
||||||
var person = byName as Person;
|
var items = byName.GetTaggedItems(new InternalItemsQuery(user)
|
||||||
|
|
||||||
if (person != null)
|
|
||||||
{
|
{
|
||||||
var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
Recursive = true
|
||||||
{
|
|
||||||
Person = byName.Name
|
|
||||||
|
|
||||||
}, new string[] { });
|
}).ToList();
|
||||||
|
|
||||||
return items.ToList();
|
return items;
|
||||||
}
|
|
||||||
|
|
||||||
var itemFilter = byName.GetItemFilter();
|
|
||||||
|
|
||||||
return user != null ?
|
|
||||||
user.RootFolder.GetRecursiveChildren(user, itemFilter).ToList() :
|
|
||||||
_libraryManager.RootFolder.GetRecursiveChildren(itemFilter).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyncedItemProgress[] GetSyncedItemProgress(DtoOptions options)
|
private SyncedItemProgress[] GetSyncedItemProgress(DtoOptions options)
|
||||||
|
|
|
@ -306,9 +306,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken)
|
private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var seasons = RootFolder.GetRecursiveChildren(i => i is Season)
|
var seasons = GetItemList(new InternalItemsQuery
|
||||||
.Cast<Season>()
|
{
|
||||||
.Where(i => i.IndexNumber.HasValue && i.IndexNumber.Value == 0 && !string.Equals(i.Name, newName, StringComparison.Ordinal))
|
IncludeItemTypes = new[] { typeof(Season).Name },
|
||||||
|
Recursive = true,
|
||||||
|
IndexNumber = 0
|
||||||
|
|
||||||
|
}).Cast<Season>()
|
||||||
|
.Where(i => !string.Equals(i.Name, newName, StringComparison.Ordinal))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var season in seasons)
|
foreach (var season in seasons)
|
||||||
|
|
|
@ -6,6 +6,8 @@ using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library
|
namespace MediaBrowser.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
|
@ -22,10 +24,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.RootFolder
|
var items = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
.GetRecursiveChildren(i => i is IHasTrailers)
|
{
|
||||||
.Cast<IHasTrailers>()
|
IncludeItemTypes = new[] { typeof(BoxSet).Name, typeof(Game).Name, typeof(Movie).Name, typeof(Series).Name },
|
||||||
.ToList();
|
Recursive = true
|
||||||
|
|
||||||
|
}).OfType<IHasTrailers>().ToList();
|
||||||
|
|
||||||
var trailerTypes = Enum.GetNames(typeof(TrailerType))
|
var trailerTypes = Enum.GetNames(typeof(TrailerType))
|
||||||
.Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true))
|
.Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true))
|
||||||
|
@ -35,7 +39,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
var trailers = _libraryManager.GetItemList(new InternalItemsQuery
|
var trailers = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { typeof(Trailer).Name },
|
IncludeItemTypes = new[] { typeof(Trailer).Name },
|
||||||
TrailerTypes = trailerTypes
|
TrailerTypes = trailerTypes,
|
||||||
|
Recursive = true
|
||||||
|
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,12 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
|
|
||||||
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var allYears = _libraryManager.RootFolder.GetRecursiveChildren(i => i.ProductionYear.HasValue)
|
var yearNumber = 1900;
|
||||||
.Select(i => i.ProductionYear ?? -1)
|
var maxYear = DateTime.UtcNow.Year + 3;
|
||||||
.Where(i => i > 0)
|
var count = maxYear - yearNumber + 1;
|
||||||
.Distinct()
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var count = allYears.Count;
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
|
|
||||||
foreach (var yearNumber in allYears)
|
while (yearNumber < DateTime.UtcNow.Year + 3)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1870,9 +1870,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||||
{
|
{
|
||||||
//Logger.Debug("GetItemIdsList query time: {0}ms. Query: {1}",
|
Logger.Debug("GetItemIdsList query time: {0}ms. Query: {1}",
|
||||||
// Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
|
Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
|
||||||
// cmd.CommandText);
|
cmd.CommandText);
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user