aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs')
-rw-r--r--Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs72
1 files changed, 0 insertions, 72 deletions
diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
deleted file mode 100644
index f5ffa1e45..000000000
--- a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Persistence;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Server.Implementations.Library.Validators
-{
- class GameGenresValidator
- {
- /// <summary>
- /// The _library manager
- /// </summary>
- private readonly ILibraryManager _libraryManager;
-
- /// <summary>
- /// The _logger
- /// </summary>
- private readonly ILogger _logger;
- private readonly IItemRepository _itemRepo;
-
- public GameGenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
- {
- _libraryManager = libraryManager;
- _logger = logger;
- _itemRepo = itemRepo;
- }
-
- /// <summary>
- /// Runs the specified progress.
- /// </summary>
- /// <param name="progress">The progress.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
- {
- var names = _itemRepo.GetGameGenreNames();
-
- var numComplete = 0;
- var count = names.Count;
-
- foreach (var name in names)
- {
- try
- {
- var item = _libraryManager.GetGameGenre(name);
-
- await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- // Don't clutter the log
- throw;
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error refreshing {GenreName}", name);
- }
-
- numComplete++;
- double percent = numComplete;
- percent /= count;
- percent *= 100;
-
- progress.Report(percent);
- }
-
- progress.Report(100);
- }
- }
-}