aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
index fac5cfc35..6a62d7fe4 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
@@ -35,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder.GetRecursiveChildren(i => !(i is IHasMusicGenres) && !(i is Game))
- .SelectMany(i => i.Genres)
- .DistinctNames()
+ var items = _libraryManager.GetGenres(new InternalItemsQuery
+ {
+ ExcludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Game).Name }
+ })
+ .Items
+ .Select(i => i.Item1)
.ToList();
var numComplete = 0;
var count = items.Count;
- foreach (var name in items)
+ foreach (var item in items)
{
try
{
- var itemByName = _libraryManager.GetGenre(name);
-
- await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -58,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
numComplete++;