mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
f008a11684
4 changed files with 129 additions and 5 deletions
|
@ -135,6 +135,7 @@
|
||||||
<Compile Include="ScheduledTasks\DailyTrigger.cs" />
|
<Compile Include="ScheduledTasks\DailyTrigger.cs" />
|
||||||
<Compile Include="ScheduledTasks\IntervalTrigger.cs" />
|
<Compile Include="ScheduledTasks\IntervalTrigger.cs" />
|
||||||
<Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
|
<Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
|
||||||
|
<Compile Include="Updates\IInstallationManager.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
|
119
MediaBrowser.Common/Updates/IInstallationManager.cs
Normal file
119
MediaBrowser.Common/Updates/IInstallationManager.cs
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Common.Events;
|
||||||
|
using MediaBrowser.Common.Plugins;
|
||||||
|
using MediaBrowser.Model.Updates;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Updates
|
||||||
|
{
|
||||||
|
public interface IInstallationManager
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The current installations
|
||||||
|
/// </summary>
|
||||||
|
List<Tuple<InstallationInfo, CancellationTokenSource>> CurrentInstallations { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The completed installations
|
||||||
|
/// </summary>
|
||||||
|
ConcurrentBag<InstallationInfo> CompletedInstallations { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when [plugin uninstalled].
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when [plugin updated].
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>>> PluginUpdated;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when [plugin updated].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plugin">The plugin.</param>
|
||||||
|
/// <param name="newVersion">The new version.</param>
|
||||||
|
void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when [plugin updated].
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when [plugin installed].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="package">The package.</param>
|
||||||
|
void OnPluginInstalled(PackageVersionInfo package);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all available packages.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <param name="packageType">Type of the package.</param>
|
||||||
|
/// <param name="applicationVersion">The application version.</param>
|
||||||
|
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||||
|
Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
|
||||||
|
PackageType? packageType = null,
|
||||||
|
Version applicationVersion = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <param name="classification">The classification.</param>
|
||||||
|
/// <param name="version">The version.</param>
|
||||||
|
/// <returns>Task{PackageVersionInfo}.</returns>
|
||||||
|
Task<PackageVersionInfo> GetPackage(string name, PackageVersionClass classification, Version version);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the latest compatible version.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <param name="classification">The classification.</param>
|
||||||
|
/// <returns>Task{PackageVersionInfo}.</returns>
|
||||||
|
Task<PackageVersionInfo> GetLatestCompatibleVersion(string name, PackageVersionClass classification = PackageVersionClass.Release);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the latest compatible version.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="availablePackages">The available packages.</param>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <param name="classification">The classification.</param>
|
||||||
|
/// <returns>PackageVersionInfo.</returns>
|
||||||
|
PackageVersionInfo GetLatestCompatibleVersion(IEnumerable<PackageInfo> availablePackages, string name, PackageVersionClass classification = PackageVersionClass.Release);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the available plugin updates.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
|
||||||
|
Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(bool withAutoUpdateEnabled, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Installs the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="package">The package.</param>
|
||||||
|
/// <param name="progress">The progress.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
/// <exception cref="System.ArgumentNullException">package</exception>
|
||||||
|
Task InstallPackage(PackageVersionInfo package, IProgress<double> progress, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Uninstalls a plugin
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plugin">The plugin.</param>
|
||||||
|
/// <exception cref="System.ArgumentException"></exception>
|
||||||
|
void UninstallPlugin(IPlugin plugin);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||||
|
/// </summary>
|
||||||
|
void Dispose();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.ScheduledTasks;
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
|
using MediaBrowser.Common.Updates;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
|
@ -70,7 +71,7 @@ namespace MediaBrowser.Controller
|
||||||
/// Gets the installation manager.
|
/// Gets the installation manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The installation manager.</value>
|
/// <value>The installation manager.</value>
|
||||||
public InstallationManager InstallationManager { get; private set; }
|
public IInstallationManager InstallationManager { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the file system manager.
|
/// Gets or sets the file system manager.
|
||||||
|
|
|
@ -3,6 +3,7 @@ using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
|
using MediaBrowser.Common.Updates;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
|
@ -21,18 +22,18 @@ namespace MediaBrowser.Controller.Updates
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages all install, uninstall and update operations (both plugins and system)
|
/// Manages all install, uninstall and update operations (both plugins and system)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class InstallationManager : BaseManager<Kernel>
|
public class InstallationManager : BaseManager<Kernel>, IInstallationManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current installations
|
/// The current installations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly List<Tuple<InstallationInfo, CancellationTokenSource>> CurrentInstallations =
|
public List<Tuple<InstallationInfo, CancellationTokenSource>> CurrentInstallations { get; set; }
|
||||||
new List<Tuple<InstallationInfo, CancellationTokenSource>>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The completed installations
|
/// The completed installations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ConcurrentBag<InstallationInfo> CompletedInstallations = new ConcurrentBag<InstallationInfo>();
|
public ConcurrentBag<InstallationInfo> CompletedInstallations { get; set; }
|
||||||
|
|
||||||
#region PluginUninstalled Event
|
#region PluginUninstalled Event
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -161,6 +162,8 @@ namespace MediaBrowser.Controller.Updates
|
||||||
throw new ArgumentNullException("httpClient");
|
throw new ArgumentNullException("httpClient");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CurrentInstallations = new List<Tuple<InstallationInfo, CancellationTokenSource>>();
|
||||||
|
CompletedInstallations = new ConcurrentBag<InstallationInfo>();
|
||||||
JsonSerializer = jsonSerializer;
|
JsonSerializer = jsonSerializer;
|
||||||
HttpClient = httpClient;
|
HttpClient = httpClient;
|
||||||
ApplicationHost = appHost;
|
ApplicationHost = appHost;
|
||||||
|
|
Loading…
Reference in a new issue