remove release channel from plugin classes

This commit is contained in:
dkanada 2020-04-11 19:33:36 +09:00
parent 974a04c129
commit 8e9aeb84b1
10 changed files with 15 additions and 86 deletions

View File

@ -211,19 +211,6 @@ namespace Emby.Server.Implementations
public IFileSystem FileSystemManager { get; set; }
/// <inheritdoc />
public ReleaseChannel SystemUpdateLevel
{
get
{
#if NIGHTLY
return PackageChannel.Nightly;
#else
return ReleaseChannel.Stable;
#endif
}
}
/// <summary>
/// Gets or sets the service provider.
/// </summary>
@ -1416,7 +1403,6 @@ namespace Emby.Server.Implementations
SupportsLibraryMonitor = true,
EncoderLocation = MediaEncoder.EncoderLocation,
SystemArchitecture = RuntimeInformation.OSArchitecture,
SystemUpdateLevel = SystemUpdateLevel,
PackageName = StartupOptions.PackageName
};
}

View File

@ -150,13 +150,11 @@ namespace Emby.Server.Implementations.Updates
/// <inheritdoc />
public IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<VersionInfo> availableVersions,
Version minVersion = null,
ReleaseChannel releaseChannel = ReleaseChannel.Stable)
Version minVersion = null)
{
var appVer = _applicationHost.ApplicationVersion;
availableVersions = availableVersions
.Where(x => x.channel == releaseChannel
&& Version.Parse(x.minimumServerVersion) <= appVer);
.Where(x => Version.Parse(x.minimumServerVersion) <= appVer);
if (minVersion != null)
{
@ -171,8 +169,7 @@ namespace Emby.Server.Implementations.Updates
IEnumerable<PackageInfo> availablePackages,
string name = null,
Guid guid = default,
Version minVersion = null,
ReleaseChannel releaseChannel = ReleaseChannel.Stable)
Version minVersion = null)
{
var package = FilterPackages(availablePackages, name, guid).FirstOrDefault();
@ -184,8 +181,7 @@ namespace Emby.Server.Implementations.Updates
return GetCompatibleVersions(
package.versions,
minVersion,
releaseChannel);
minVersion);
}
/// <inheritdoc />
@ -193,12 +189,10 @@ namespace Emby.Server.Implementations.Updates
{
var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false);
var systemUpdateLevel = _applicationHost.SystemUpdateLevel;
// Figure out what needs to be installed
foreach (var plugin in _applicationHost.Plugins)
{
var compatibleVersions = GetCompatibleVersions(catalog, plugin.Name, plugin.Id, plugin.Version, systemUpdateLevel);
var compatibleVersions = GetCompatibleVersions(catalog, plugin.Name, plugin.Id, plugin.Version);
var version = compatibleVersions.FirstOrDefault(y => y.versionCode > plugin.Version);
if (version != null
&& !CompletedInstallations.Any(x => string.Equals(x.AssemblyGuid, version.guid, StringComparison.OrdinalIgnoreCase)))
@ -221,7 +215,6 @@ namespace Emby.Server.Implementations.Updates
Id = Guid.NewGuid(),
Name = package.name,
AssemblyGuid = package.guid,
UpdateClass = package.channel,
Version = package.versionString
};
@ -313,13 +306,13 @@ namespace Emby.Server.Implementations.Updates
// Do plugin-specific processing
if (plugin == null)
{
_logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionString ?? string.Empty, package.channel);
_logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionString ?? string.Empty);
PluginInstalled?.Invoke(this, new GenericEventArgs<VersionInfo>(package));
}
else
{
_logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.versionString ?? string.Empty, package.channel);
_logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.versionString ?? string.Empty);
PluginUpdated?.Invoke(this, new GenericEventArgs<(IPlugin, VersionInfo)>((plugin, package)));
}

View File

@ -71,13 +71,6 @@ namespace MediaBrowser.Api
/// <value>The version.</value>
[ApiMember(Name = "Version", Description = "Optional version. Defaults to latest version.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string Version { get; set; }
/// <summary>
/// Gets or sets the update class.
/// </summary>
/// <value>The update class.</value>
[ApiMember(Name = "UpdateClass", Description = "Optional update class (Dev, Beta, Release). Defaults to Release.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public ReleaseChannel UpdateClass { get; set; }
}
/// <summary>
@ -152,8 +145,7 @@ namespace MediaBrowser.Api
packages,
request.Name,
string.IsNullOrEmpty(request.AssemblyGuid) ? Guid.Empty : Guid.Parse(request.AssemblyGuid),
string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version),
request.UpdateClass).FirstOrDefault();
string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version)).FirstOrDefault();
if (package == null)
{

View File

@ -47,12 +47,6 @@ namespace MediaBrowser.Common
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
bool CanSelfRestart { get; }
/// <summary>
/// Gets the version class of the system.
/// </summary>
/// <value><see cref="ReleaseChannel.Stable" /> or <see cref="ReleaseChannel.Nightly" />.</value>
ReleaseChannel SystemUpdateLevel { get; }
/// <summary>
/// Gets the application version.
/// </summary>

View File

@ -65,12 +65,10 @@ namespace MediaBrowser.Common.Updates
/// </summary>
/// <param name="availableVersions">The available version of the plugin.</param>
/// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="releaseChannel">The classification of updates.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<VersionInfo> availableVersions,
Version minVersion = null,
ReleaseChannel releaseChannel = ReleaseChannel.Stable);
Version minVersion = null);
/// <summary>
/// Returns all compatible versions ordered from newest to oldest.
@ -79,14 +77,12 @@ namespace MediaBrowser.Common.Updates
/// <param name="name">The name.</param>
/// <param name="guid">The guid of the plugin.</param>
/// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="releaseChannel">The classification.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<PackageInfo> availablePackages,
string name = null,
Guid guid = default,
Version minVersion = null,
ReleaseChannel releaseChannel = ReleaseChannel.Stable);
Version minVersion = null);
/// <summary>
/// Returns the available plugin updates.

View File

@ -9,17 +9,17 @@ namespace MediaBrowser.Model.Services
{
/// <summary>
/// Order in which Request Filters are executed.
/// &lt;0 Executed before global request filters
/// &gt;0 Executed after global request filters
/// &lt;0 Executed before global request filters.
/// &gt;0 Executed after global request filters.
/// </summary>
int Priority { get; }
/// <summary>
/// The request filter is executed before the service.
/// </summary>
/// <param name="req">The http request wrapper</param>
/// <param name="res">The http response wrapper</param>
/// <param name="requestDto">The request DTO</param>
/// <param name="req">The http request wrapper.</param>
/// <param name="res">The http response wrapper.</param>
/// <param name="requestDto">The request DTO.</param>
void RequestFilter(IRequest req, HttpResponse res, object requestDto);
}
}

View File

@ -27,8 +27,6 @@ namespace MediaBrowser.Model.System
/// </summary>
public class SystemInfo : PublicSystemInfo
{
public ReleaseChannel SystemUpdateLevel { get; set; }
/// <summary>
/// Gets or sets the display name of the operating system.
/// </summary>

View File

@ -30,11 +30,5 @@ namespace MediaBrowser.Model.Updates
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
/// <summary>
/// Gets or sets the update class.
/// </summary>
/// <value>The update class.</value>
public ReleaseChannel UpdateClass { get; set; }
}
}

View File

@ -1,18 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Enum PackageVersionClass.
/// </summary>
public enum ReleaseChannel
{
/// <summary>
/// The stable.
/// </summary>
Stable = 0,
/// <summary>
/// The nightly.
/// </summary>
Nightly = 1
}
}

View File

@ -34,12 +34,6 @@ namespace MediaBrowser.Model.Updates
/// <value>The version.</value>
public Version versionCode { get; set; }
/// <summary>
/// Gets or sets the release channel.
/// </summary>
/// <value>The release channel for a given package version.</value>
public ReleaseChannel channel { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>