update plugin classes for nightly builds

This commit is contained in:
dkanada 2020-02-26 01:58:39 +09:00
parent 557b165f01
commit 974a04c129
18 changed files with 150 additions and 333 deletions

View File

@ -421,7 +421,7 @@ namespace Emby.Server.Implementations.Activity
}); });
} }
private void OnPluginUpdated(object sender, GenericEventArgs<(IPlugin, PackageVersionInfo)> e) private void OnPluginUpdated(object sender, GenericEventArgs<(IPlugin, VersionInfo)> e)
{ {
CreateLogEntry(new ActivityLogEntry CreateLogEntry(new ActivityLogEntry
{ {
@ -433,7 +433,7 @@ namespace Emby.Server.Implementations.Activity
ShortOverview = string.Format( ShortOverview = string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
_localization.GetLocalizedString("VersionNumber"), _localization.GetLocalizedString("VersionNumber"),
e.Argument.Item2.versionStr), e.Argument.Item2.versionString),
Overview = e.Argument.Item2.description Overview = e.Argument.Item2.description
}); });
} }
@ -450,7 +450,7 @@ namespace Emby.Server.Implementations.Activity
}); });
} }
private void OnPluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> e) private void OnPluginInstalled(object sender, GenericEventArgs<VersionInfo> e)
{ {
CreateLogEntry(new ActivityLogEntry CreateLogEntry(new ActivityLogEntry
{ {
@ -462,7 +462,7 @@ namespace Emby.Server.Implementations.Activity
ShortOverview = string.Format( ShortOverview = string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
_localization.GetLocalizedString("VersionNumber"), _localization.GetLocalizedString("VersionNumber"),
e.Argument.versionStr) e.Argument.versionString)
}); });
} }

View File

@ -212,14 +212,14 @@ namespace Emby.Server.Implementations
public IFileSystem FileSystemManager { get; set; } public IFileSystem FileSystemManager { get; set; }
/// <inheritdoc /> /// <inheritdoc />
public PackageVersionClass SystemUpdateLevel public ReleaseChannel SystemUpdateLevel
{ {
get get
{ {
#if BETA #if NIGHTLY
return PackageVersionClass.Beta; return PackageChannel.Nightly;
#else #else
return PackageVersionClass.Release; return ReleaseChannel.Stable;
#endif #endif
} }
} }
@ -1003,7 +1003,7 @@ namespace Emby.Server.Implementations
AuthenticatedAttribute.AuthService = AuthService; AuthenticatedAttribute.AuthService = AuthService;
} }
private async void PluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> args) private async void PluginInstalled(object sender, GenericEventArgs<VersionInfo> args)
{ {
string dir = Path.Combine(ApplicationPaths.PluginsPath, args.Argument.name); string dir = Path.Combine(ApplicationPaths.PluginsPath, args.Argument.name);
var types = Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories) var types = Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories)

View File

@ -23,12 +23,12 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Updates namespace Emby.Server.Implementations.Updates
{ {
/// <summary> /// <summary>
/// Manages all install, uninstall and update operations (both plugins and system). /// Manages all install, uninstall, and update operations for the system and individual plugins.
/// </summary> /// </summary>
public class InstallationManager : IInstallationManager public class InstallationManager : IInstallationManager
{ {
/// <summary> /// <summary>
/// The _logger. /// The logger.
/// </summary> /// </summary>
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IApplicationPaths _appPaths; private readonly IApplicationPaths _appPaths;
@ -101,10 +101,10 @@ namespace Emby.Server.Implementations.Updates
public event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled; public event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
/// <inheritdoc /> /// <inheritdoc />
public event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated; public event EventHandler<GenericEventArgs<(IPlugin, VersionInfo)>> PluginUpdated;
/// <inheritdoc /> /// <inheritdoc />
public event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled; public event EventHandler<GenericEventArgs<VersionInfo>> PluginInstalled;
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal; public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal;
@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.Updates
using (var response = await _httpClient.SendAsync( using (var response = await _httpClient.SendAsync(
new HttpRequestOptions new HttpRequestOptions
{ {
Url = "https://repo.jellyfin.org/releases/plugin/manifest.json", Url = "https://repo.jellyfin.org/releases/plugin/manifest-water.json",
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
CacheMode = CacheMode.Unconditional, CacheMode = CacheMode.Unconditional,
CacheLength = TimeSpan.FromMinutes(3) CacheLength = TimeSpan.FromMinutes(3)
@ -148,48 +148,48 @@ namespace Emby.Server.Implementations.Updates
} }
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<PackageVersionInfo> GetCompatibleVersions( public IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<PackageVersionInfo> availableVersions, IEnumerable<VersionInfo> availableVersions,
Version minVersion = null, Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release) ReleaseChannel releaseChannel = ReleaseChannel.Stable)
{ {
var appVer = _applicationHost.ApplicationVersion; var appVer = _applicationHost.ApplicationVersion;
availableVersions = availableVersions availableVersions = availableVersions
.Where(x => x.classification == classification .Where(x => x.channel == releaseChannel
&& Version.Parse(x.requiredVersionStr) <= appVer); && Version.Parse(x.minimumServerVersion) <= appVer);
if (minVersion != null) if (minVersion != null)
{ {
availableVersions = availableVersions.Where(x => x.Version >= minVersion); availableVersions = availableVersions.Where(x => x.versionCode >= minVersion);
} }
return availableVersions.OrderByDescending(x => x.Version); return availableVersions.OrderByDescending(x => x.versionCode);
} }
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<PackageVersionInfo> GetCompatibleVersions( public IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<PackageInfo> availablePackages, IEnumerable<PackageInfo> availablePackages,
string name = null, string name = null,
Guid guid = default, Guid guid = default,
Version minVersion = null, Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release) ReleaseChannel releaseChannel = ReleaseChannel.Stable)
{ {
var package = FilterPackages(availablePackages, name, guid).FirstOrDefault(); var package = FilterPackages(availablePackages, name, guid).FirstOrDefault();
// Package not found. // Package not found in repository
if (package == null) if (package == null)
{ {
return Enumerable.Empty<PackageVersionInfo>(); return Enumerable.Empty<VersionInfo>();
} }
return GetCompatibleVersions( return GetCompatibleVersions(
package.versions, package.versions,
minVersion, minVersion,
classification); releaseChannel);
} }
/// <inheritdoc /> /// <inheritdoc />
public async IAsyncEnumerable<PackageVersionInfo> GetAvailablePluginUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) public async IAsyncEnumerable<VersionInfo> GetAvailablePluginUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
{ {
var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false); var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false);
@ -198,8 +198,8 @@ namespace Emby.Server.Implementations.Updates
// Figure out what needs to be installed // Figure out what needs to be installed
foreach (var plugin in _applicationHost.Plugins) 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, systemUpdateLevel);
var version = compatibleversions.FirstOrDefault(y => y.Version > plugin.Version); var version = compatibleVersions.FirstOrDefault(y => y.versionCode > plugin.Version);
if (version != null if (version != null
&& !CompletedInstallations.Any(x => string.Equals(x.AssemblyGuid, version.guid, StringComparison.OrdinalIgnoreCase))) && !CompletedInstallations.Any(x => string.Equals(x.AssemblyGuid, version.guid, StringComparison.OrdinalIgnoreCase)))
{ {
@ -209,7 +209,7 @@ namespace Emby.Server.Implementations.Updates
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken) public async Task InstallPackage(VersionInfo package, CancellationToken cancellationToken)
{ {
if (package == null) if (package == null)
{ {
@ -221,8 +221,8 @@ namespace Emby.Server.Implementations.Updates
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
Name = package.name, Name = package.name,
AssemblyGuid = package.guid, AssemblyGuid = package.guid,
UpdateClass = package.classification, UpdateClass = package.channel,
Version = package.versionStr Version = package.versionString
}; };
var innerCancellationTokenSource = new CancellationTokenSource(); var innerCancellationTokenSource = new CancellationTokenSource();
@ -240,7 +240,7 @@ namespace Emby.Server.Implementations.Updates
var installationEventArgs = new InstallationEventArgs var installationEventArgs = new InstallationEventArgs
{ {
InstallationInfo = installationInfo, InstallationInfo = installationInfo,
PackageVersionInfo = package VersionInfo = package
}; };
PackageInstalling?.Invoke(this, installationEventArgs); PackageInstalling?.Invoke(this, installationEventArgs);
@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.Updates
_currentInstallations.Remove(tuple); _currentInstallations.Remove(tuple);
} }
_logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.versionStr); _logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.versionString);
PackageInstallationCancelled?.Invoke(this, installationEventArgs); PackageInstallationCancelled?.Invoke(this, installationEventArgs);
@ -301,7 +301,7 @@ namespace Emby.Server.Implementations.Updates
/// <param name="package">The package.</param> /// <param name="package">The package.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="Task" />.</returns> /// <returns><see cref="Task" />.</returns>
private async Task InstallPackageInternal(PackageVersionInfo package, CancellationToken cancellationToken) private async Task InstallPackageInternal(VersionInfo package, CancellationToken cancellationToken)
{ {
// Set last update time if we were installed before // Set last update time if we were installed before
IPlugin plugin = _applicationHost.Plugins.FirstOrDefault(p => string.Equals(p.Id.ToString(), package.guid, StringComparison.OrdinalIgnoreCase)) IPlugin plugin = _applicationHost.Plugins.FirstOrDefault(p => string.Equals(p.Id.ToString(), package.guid, StringComparison.OrdinalIgnoreCase))
@ -313,26 +313,26 @@ namespace Emby.Server.Implementations.Updates
// Do plugin-specific processing // Do plugin-specific processing
if (plugin == null) if (plugin == null)
{ {
_logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification); _logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionString ?? string.Empty, package.channel);
PluginInstalled?.Invoke(this, new GenericEventArgs<PackageVersionInfo>(package)); PluginInstalled?.Invoke(this, new GenericEventArgs<VersionInfo>(package));
} }
else else
{ {
_logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification); _logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.versionString ?? string.Empty, package.channel);
PluginUpdated?.Invoke(this, new GenericEventArgs<(IPlugin, PackageVersionInfo)>((plugin, package))); PluginUpdated?.Invoke(this, new GenericEventArgs<(IPlugin, VersionInfo)>((plugin, package)));
} }
_applicationHost.NotifyPendingRestart(); _applicationHost.NotifyPendingRestart();
} }
private async Task PerformPackageInstallation(PackageVersionInfo package, CancellationToken cancellationToken) private async Task PerformPackageInstallation(VersionInfo package, CancellationToken cancellationToken)
{ {
var extension = Path.GetExtension(package.targetFilename); var extension = Path.GetExtension(package.filename);
if (!string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase)) if (!string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase))
{ {
_logger.LogError("Only zip packages are supported. {Filename} is not a zip archive.", package.targetFilename); _logger.LogError("Only zip packages are supported. {Filename} is not a zip archive.", package.filename);
return; return;
} }
@ -379,7 +379,7 @@ namespace Emby.Server.Implementations.Updates
} }
/// <summary> /// <summary>
/// Uninstalls a plugin /// Uninstalls a plugin.
/// </summary> /// </summary>
/// <param name="plugin">The plugin.</param> /// <param name="plugin">The plugin.</param>
public void UninstallPlugin(IPlugin plugin) public void UninstallPlugin(IPlugin plugin)

View File

@ -42,23 +42,6 @@ namespace MediaBrowser.Api
[Authenticated] [Authenticated]
public class GetPackages : IReturn<PackageInfo[]> public class GetPackages : IReturn<PackageInfo[]>
{ {
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[ApiMember(Name = "PackageType", Description = "Optional package type filter (System/UserInstalled)", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string PackageType { get; set; }
[ApiMember(Name = "TargetSystems", Description = "Optional. Filter by target system type. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string TargetSystems { get; set; }
[ApiMember(Name = "IsPremium", Description = "Optional. Filter by premium status", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? IsPremium { get; set; }
[ApiMember(Name = "IsAdult", Description = "Optional. Filter by package that contain adult content.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? IsAdult { get; set; }
public bool? IsAppStoreEnabled { get; set; }
} }
/// <summary> /// <summary>
@ -94,7 +77,7 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <value>The update class.</value> /// <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")] [ApiMember(Name = "UpdateClass", Description = "Optional update class (Dev, Beta, Release). Defaults to Release.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public PackageVersionClass UpdateClass { get; set; } public ReleaseChannel UpdateClass { get; set; }
} }
/// <summary> /// <summary>
@ -154,23 +137,6 @@ namespace MediaBrowser.Api
{ {
IEnumerable<PackageInfo> packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false); IEnumerable<PackageInfo> packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false);
if (!string.IsNullOrEmpty(request.TargetSystems))
{
var apps = request.TargetSystems.Split(',').Select(i => (PackageTargetSystem)Enum.Parse(typeof(PackageTargetSystem), i, true));
packages = packages.Where(p => apps.Contains(p.targetSystem));
}
if (request.IsAdult.HasValue)
{
packages = packages.Where(p => p.adult == request.IsAdult.Value);
}
if (request.IsAppStoreEnabled.HasValue)
{
packages = packages.Where(p => p.enableInAppStore == request.IsAppStoreEnabled.Value);
}
return ToOptimizedResult(packages.ToArray()); return ToOptimizedResult(packages.ToArray());
} }

View File

@ -35,7 +35,6 @@ namespace MediaBrowser.Common.Extensions
{ {
return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str))); return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
} }
#pragma warning restore CA5351 #pragma warning restore CA5351
} }
} }

View File

@ -50,8 +50,8 @@ namespace MediaBrowser.Common
/// <summary> /// <summary>
/// Gets the version class of the system. /// Gets the version class of the system.
/// </summary> /// </summary>
/// <value><see cref="PackageVersionClass.Release" /> or <see cref="PackageVersionClass.Beta" />.</value> /// <value><see cref="ReleaseChannel.Stable" /> or <see cref="ReleaseChannel.Nightly" />.</value>
PackageVersionClass SystemUpdateLevel { get; } ReleaseChannel SystemUpdateLevel { get; }
/// <summary> /// <summary>
/// Gets the application version. /// Gets the application version.

View File

@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Plugins
} }
/// <summary> /// <summary>
/// Called when just before the plugin is uninstalled from the server. /// Called just before the plugin is uninstalled from the server.
/// </summary> /// </summary>
public virtual void OnUninstalling() public virtual void OnUninstalling()
{ {
@ -101,7 +101,7 @@ namespace MediaBrowser.Common.Plugins
private readonly object _configurationSyncLock = new object(); private readonly object _configurationSyncLock = new object();
/// <summary> /// <summary>
/// The save lock. /// The configuration save lock.
/// </summary> /// </summary>
private readonly object _configurationSaveLock = new object(); private readonly object _configurationSaveLock = new object();
@ -148,7 +148,7 @@ namespace MediaBrowser.Common.Plugins
protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath); protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath);
/// <summary> /// <summary>
/// Gets or sets the plugin's configuration. /// Gets or sets the plugin configuration.
/// </summary> /// </summary>
/// <value>The configuration.</value> /// <value>The configuration.</value>
public TConfigurationType Configuration public TConfigurationType Configuration
@ -186,7 +186,7 @@ namespace MediaBrowser.Common.Plugins
public string ConfigurationFilePath => Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); public string ConfigurationFilePath => Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName);
/// <summary> /// <summary>
/// Gets the plugin's configuration. /// Gets the plugin configuration.
/// </summary> /// </summary>
/// <value>The configuration.</value> /// <value>The configuration.</value>
BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration; BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration;

View File

@ -29,12 +29,12 @@ namespace MediaBrowser.Common.Updates
/// <summary> /// <summary>
/// Occurs when a plugin is updated. /// Occurs when a plugin is updated.
/// </summary> /// </summary>
event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated; event EventHandler<GenericEventArgs<(IPlugin, VersionInfo)>> PluginUpdated;
/// <summary> /// <summary>
/// Occurs when a plugin is installed. /// Occurs when a plugin is installed.
/// </summary> /// </summary>
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled; event EventHandler<GenericEventArgs<VersionInfo>> PluginInstalled;
/// <summary> /// <summary>
/// Gets the completed installations. /// Gets the completed installations.
@ -65,12 +65,12 @@ namespace MediaBrowser.Common.Updates
/// </summary> /// </summary>
/// <param name="availableVersions">The available version of the plugin.</param> /// <param name="availableVersions">The available version of the plugin.</param>
/// <param name="minVersion">The minimum required version of the plugin.</param> /// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="classification">The classification of updates.</param> /// <param name="releaseChannel">The classification of updates.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns> /// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<PackageVersionInfo> GetCompatibleVersions( IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<PackageVersionInfo> availableVersions, IEnumerable<VersionInfo> availableVersions,
Version minVersion = null, Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release); ReleaseChannel releaseChannel = ReleaseChannel.Stable);
/// <summary> /// <summary>
/// Returns all compatible versions ordered from newest to oldest. /// Returns all compatible versions ordered from newest to oldest.
@ -79,21 +79,21 @@ namespace MediaBrowser.Common.Updates
/// <param name="name">The name.</param> /// <param name="name">The name.</param>
/// <param name="guid">The guid of the plugin.</param> /// <param name="guid">The guid of the plugin.</param>
/// <param name="minVersion">The minimum required version of the plugin.</param> /// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="classification">The classification.</param> /// <param name="releaseChannel">The classification.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns> /// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<PackageVersionInfo> GetCompatibleVersions( IEnumerable<VersionInfo> GetCompatibleVersions(
IEnumerable<PackageInfo> availablePackages, IEnumerable<PackageInfo> availablePackages,
string name = null, string name = null,
Guid guid = default, Guid guid = default,
Version minVersion = null, Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release); ReleaseChannel releaseChannel = ReleaseChannel.Stable);
/// <summary> /// <summary>
/// Returns the available plugin updates. /// Returns the available plugin updates.
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The available plugin updates.</returns> /// <returns>The available plugin updates.</returns>
IAsyncEnumerable<PackageVersionInfo> GetAvailablePluginUpdates(CancellationToken cancellationToken = default); IAsyncEnumerable<VersionInfo> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Installs the package. /// Installs the package.
@ -101,7 +101,7 @@ namespace MediaBrowser.Common.Updates
/// <param name="package">The package.</param> /// <param name="package">The package.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="Task" />.</returns> /// <returns><see cref="Task" />.</returns>
Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken = default); Task InstallPackage(VersionInfo package, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Uninstalls a plugin. /// Uninstalls a plugin.

View File

@ -9,6 +9,6 @@ namespace MediaBrowser.Common.Updates
{ {
public InstallationInfo InstallationInfo { get; set; } public InstallationInfo InstallationInfo { get; set; }
public PackageVersionInfo PackageVersionInfo { get; set; } public VersionInfo VersionInfo { get; set; }
} }
} }

View File

@ -11,7 +11,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' " >true</TreatWarningsAsErrors> <TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' ">true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

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

View File

@ -17,13 +17,13 @@ namespace MediaBrowser.Model.Updates
/// <value>The available version.</value> /// <value>The available version.</value>
public string AvailableVersion public string AvailableVersion
{ {
get => Package != null ? Package.versionStr : "0.0.0.1"; get => Package != null ? Package.versionString : "0.0.0.1";
set { } // need this for the serializer set { } // need this for the serializer
} }
/// <summary> /// <summary>
/// Get or sets package information for an available update /// Get or sets package information for an available update
/// </summary> /// </summary>
public PackageVersionInfo Package { get; set; } public VersionInfo Package { get; set; }
} }
} }

View File

@ -35,6 +35,6 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the update class. /// Gets or sets the update class.
/// </summary> /// </summary>
/// <value>The update class.</value> /// <value>The update class.</value>
public PackageVersionClass UpdateClass { get; set; } public ReleaseChannel UpdateClass { get; set; }
} }
} }

View File

@ -8,12 +8,6 @@ namespace MediaBrowser.Model.Updates
/// </summary> /// </summary>
public class PackageInfo public class PackageInfo
{ {
/// <summary>
/// The internal id of this package.
/// </summary>
/// <value>The id.</value>
public string id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
@ -32,24 +26,6 @@ namespace MediaBrowser.Model.Updates
/// <value>The overview.</value> /// <value>The overview.</value>
public string overview { get; set; } public string overview { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is premium.
/// </summary>
/// <value><c>true</c> if this instance is premium; otherwise, <c>false</c>.</value>
public bool isPremium { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is adult only content.
/// </summary>
/// <value><c>true</c> if this instance is adult; otherwise, <c>false</c>.</value>
public bool adult { get; set; }
/// <summary>
/// Gets or sets the rich desc URL.
/// </summary>
/// <value>The rich desc URL.</value>
public string richDescUrl { get; set; }
/// <summary> /// <summary>
/// Gets or sets the thumb image. /// Gets or sets the thumb image.
/// </summary> /// </summary>
@ -63,16 +39,10 @@ namespace MediaBrowser.Model.Updates
public string previewImage { get; set; } public string previewImage { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type. /// Gets or sets the target filename for the downloaded binary.
/// </summary>
/// <value>The type.</value>
public string type { get; set; }
/// <summary>
/// Gets or sets the target filename.
/// </summary> /// </summary>
/// <value>The target filename.</value> /// <value>The target filename.</value>
public string targetFilename { get; set; } public string filename { get; set; }
/// <summary> /// <summary>
/// Gets or sets the owner. /// Gets or sets the owner.
@ -87,90 +57,24 @@ namespace MediaBrowser.Model.Updates
public string category { get; set; } public string category { get; set; }
/// <summary> /// <summary>
/// Gets or sets the catalog tile color. /// The guid of the assembly associated with this plugin.
/// </summary>
/// <value>The owner.</value>
public string tileColor { get; set; }
/// <summary>
/// Gets or sets the feature id of this package (if premium).
/// </summary>
/// <value>The feature id.</value>
public string featureId { get; set; }
/// <summary>
/// Gets or sets the registration info for this package (if premium).
/// </summary>
/// <value>The registration info.</value>
public string regInfo { get; set; }
/// <summary>
/// Gets or sets the price for this package (if premium).
/// </summary>
/// <value>The price.</value>
public float price { get; set; }
/// <summary>
/// Gets or sets the target system for this plug-in (Server, MBTheater, MBClassic).
/// </summary>
/// <value>The target system.</value>
public PackageTargetSystem targetSystem { get; set; }
/// <summary>
/// The guid of the assembly associated with this package (if a plug-in).
/// This is used to identify the proper item for automatic updates. /// This is used to identify the proper item for automatic updates.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
public string guid { get; set; } public string guid { get; set; }
/// <summary>
/// Gets or sets the total number of ratings for this package.
/// </summary>
/// <value>The total ratings.</value>
public int? totalRatings { get; set; }
/// <summary>
/// Gets or sets the average rating for this package .
/// </summary>
/// <value>The rating.</value>
public float avgRating { get; set; }
/// <summary>
/// Gets or sets whether or not this package is registered.
/// </summary>
/// <value>True if registered.</value>
public bool isRegistered { get; set; }
/// <summary>
/// Gets or sets the expiration date for this package.
/// </summary>
/// <value>Expiration Date.</value>
public DateTime expDate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the versions. /// Gets or sets the versions.
/// </summary> /// </summary>
/// <value>The versions.</value> /// <value>The versions.</value>
public IReadOnlyList<PackageVersionInfo> versions { get; set; } public IReadOnlyList<VersionInfo> versions { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable in application store].
/// </summary>
/// <value><c>true</c> if [enable in application store]; otherwise, <c>false</c>.</value>
public bool enableInAppStore { get; set; }
/// <summary>
/// Gets or sets the installs.
/// </summary>
/// <value>The installs.</value>
public int installs { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PackageInfo"/> class. /// Initializes a new instance of the <see cref="PackageInfo"/> class.
/// </summary> /// </summary>
public PackageInfo() public PackageInfo()
{ {
versions = Array.Empty<PackageVersionInfo>(); versions = Array.Empty<VersionInfo>();
} }
} }
} }

View File

@ -1,23 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Enum PackageType.
/// </summary>
public enum PackageTargetSystem
{
/// <summary>
/// Server.
/// </summary>
Server,
/// <summary>
/// MB Theater.
/// </summary>
MBTheater,
/// <summary>
/// MB Classic.
/// </summary>
MBClassic
}
}

View File

@ -1,97 +0,0 @@
#pragma warning disable CS1591
#pragma warning disable SA1600
using System;
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class PackageVersionInfo.
/// </summary>
public class PackageVersionInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string name { get; set; }
/// <summary>
/// Gets or sets the guid.
/// </summary>
/// <value>The guid.</value>
public string guid { get; set; }
/// <summary>
/// Gets or sets the version STR.
/// </summary>
/// <value>The version STR.</value>
public string versionStr { get; set; }
/// <summary>
/// The _version
/// </summary>
private Version _version;
/// <summary>
/// Gets or sets the version.
/// Had to make this an interpreted property since Protobuf can't handle Version
/// </summary>
/// <value>The version.</value>
[JsonIgnore]
public Version Version
{
get
{
if (_version == null)
{
var ver = versionStr;
_version = new Version(string.IsNullOrEmpty(ver) ? "0.0.0.1" : ver);
}
return _version;
}
}
/// <summary>
/// Gets or sets the classification.
/// </summary>
/// <value>The classification.</value>
public PackageVersionClass classification { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string description { get; set; }
/// <summary>
/// Gets or sets the required version STR.
/// </summary>
/// <value>The required version STR.</value>
public string requiredVersionStr { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string sourceUrl { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string checksum { get; set; }
/// <summary>
/// Gets or sets the target filename.
/// </summary>
/// <value>The target filename.</value>
public string targetFilename { get; set; }
public string infoUrl { get; set; }
public string runtimes { get; set; }
}
}

View File

@ -3,21 +3,16 @@ namespace MediaBrowser.Model.Updates
/// <summary> /// <summary>
/// Enum PackageVersionClass. /// Enum PackageVersionClass.
/// </summary> /// </summary>
public enum PackageVersionClass public enum ReleaseChannel
{ {
/// <summary> /// <summary>
/// The release. /// The stable.
/// </summary> /// </summary>
Release = 0, Stable = 0,
/// <summary> /// <summary>
/// The beta. /// The nightly.
/// </summary> /// </summary>
Beta = 1, Nightly = 1
/// <summary>
/// The dev.
/// </summary>
Dev = 2
} }
} }

View File

@ -0,0 +1,73 @@
#pragma warning disable CS1591
#pragma warning disable SA1600
using System;
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class PackageVersionInfo.
/// </summary>
public class VersionInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string name { get; set; }
/// <summary>
/// Gets or sets the guid.
/// </summary>
/// <value>The guid.</value>
public string guid { get; set; }
/// <summary>
/// Gets or sets the version string.
/// </summary>
/// <value>The version string.</value>
public string versionString { get; set; }
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <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>
/// <value>The description.</value>
public string description { get; set; }
/// <summary>
/// Gets or sets the minimum required version for the server.
/// </summary>
/// <value>The minimum required version.</value>
public string minimumServerVersion { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string sourceUrl { get; set; }
/// <summary>
/// Gets or sets a checksum for the binary.
/// </summary>
/// <value>The checksum.</value>
public string checksum { get; set; }
/// <summary>
/// Gets or sets the target filename for the downloaded binary.
/// </summary>
/// <value>The target filename.</value>
public string filename { get; set; }
}
}