aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Updates
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-06-27 15:08:57 -0400
committerEric Reed <ebr@mediabrowser3.com>2013-06-27 15:08:57 -0400
commit55bbfc2dcc6431c1d2b6320c47a600e98a7adc1d (patch)
tree3930ddb361a1a9ac746be8f42c17c81ea3ae87e6 /MediaBrowser.Server.Implementations/Updates
parent30eafa61a547f8b484bc3501d2be6b05138f68e6 (diff)
Change update checks to use static file
Diffstat (limited to 'MediaBrowser.Server.Implementations/Updates')
-rw-r--r--MediaBrowser.Server.Implementations/Updates/InstallationManager.cs41
1 files changed, 40 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
index 9c3b532ec..4dd9c47d1 100644
--- a/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
+++ b/MediaBrowser.Server.Implementations/Updates/InstallationManager.cs
@@ -171,6 +171,26 @@ namespace MediaBrowser.Server.Implementations.Updates
{
var packages = (await _packageManager.GetAvailablePackages(cancellationToken).ConfigureAwait(false)).ToList();
+ return FilterPackages(packages, packageType, applicationVersion);
+ }
+
+ /// <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>
+ protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesStatic(CancellationToken cancellationToken,
+ PackageType? packageType = null,
+ Version applicationVersion = null)
+ {
+ var packages = (await _packageManager.GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false)).ToList();
+ return FilterPackages(packages, packageType, applicationVersion);
+ }
+
+ protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, PackageType? packageType, Version applicationVersion)
+ {
if (packageType.HasValue)
{
packages = packages.Where(p => p.type == packageType.Value).ToList();
@@ -265,7 +285,8 @@ namespace MediaBrowser.Server.Implementations.Updates
}
/// <summary>
- /// Gets the available plugin updates.
+ /// Gets the available plugin updates including registration information for each one.
+ /// Used with API and catalog.
/// </summary>
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -273,7 +294,25 @@ namespace MediaBrowser.Server.Implementations.Updates
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
{
var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false);
+ return FilterCatalog(catalog, withAutoUpdateEnabled);
+ }
+ /// <summary>
+ /// Gets the available plugin updates from a static resource - no registration information.
+ /// Used for update checks.
+ /// </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>
+ public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesStatic(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
+ {
+ var catalog = await GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false);
+ return FilterCatalog(catalog, withAutoUpdateEnabled);
+ }
+
+ protected IEnumerable<PackageVersionInfo> FilterCatalog(IEnumerable<PackageInfo> catalog, bool withAutoUpdateEnabled)
+ {
+
var plugins = ApplicationHost.Plugins;
if (withAutoUpdateEnabled)