Improve IInstallationManager interface

This commit is contained in:
Bond_009
2019-10-08 20:51:11 +02:00
parent 89a21c96c0
commit d529f81cd9
12 changed files with 149 additions and 247 deletions

View File

@@ -1,24 +1,23 @@
using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Progress;
using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.ScheduledTasks
{
/// <summary>
/// Plugin Update Task
/// Plugin Update Task.
/// </summary>
public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
{
/// <summary>
/// The _logger
/// The _logger.
/// </summary>
private readonly ILogger _logger;
@@ -31,7 +30,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
/// <summary>
/// Creates the triggers that define when the task will run
/// Creates the triggers that define when the task will run.
/// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
@@ -44,16 +43,16 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
/// <summary>
/// Update installed plugins
/// Update installed plugins.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
/// <returns><see cref="Task" />.</returns>
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
{
progress.Report(0);
var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(typeof(PluginUpdateTask).Assembly.GetName().Version, true, cancellationToken).ConfigureAwait(false)).ToList();
var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(cancellationToken).ConfigureAwait(false)).ToList();
progress.Report(10);
@@ -94,18 +93,25 @@ namespace Emby.Server.Implementations.ScheduledTasks
progress.Report(100);
}
/// <inheritdoc />
public string Name => "Check for plugin updates";
/// <inheritdoc />
public string Description => "Downloads and installs updates for plugins that are configured to update automatically.";
/// <inheritdoc />
public string Category => "Application";
/// <inheritdoc />
public string Key => "PluginUpdates";
/// <inheritdoc />
public bool IsHidden => false;
/// <inheritdoc />
public bool IsEnabled => true;
/// <inheritdoc />
public bool IsLogged => true;
}
}