standardize plugin version and guid properties

This commit is contained in:
dkanada 2020-04-11 19:52:40 +09:00
parent 8e9aeb84b1
commit 78abbcc251
6 changed files with 16 additions and 70 deletions

View File

@ -433,7 +433,7 @@ namespace Emby.Server.Implementations.Activity
ShortOverview = string.Format(
CultureInfo.InvariantCulture,
_localization.GetLocalizedString("VersionNumber"),
e.Argument.Item2.versionString),
e.Argument.Item2.version),
Overview = e.Argument.Item2.description
});
}
@ -462,7 +462,7 @@ namespace Emby.Server.Implementations.Activity
ShortOverview = string.Format(
CultureInfo.InvariantCulture,
_localization.GetLocalizedString("VersionNumber"),
e.Argument.versionString)
e.Argument.version)
});
}

View File

@ -158,10 +158,10 @@ namespace Emby.Server.Implementations.Updates
if (minVersion != null)
{
availableVersions = availableVersions.Where(x => x.versionCode >= minVersion);
availableVersions = availableVersions.Where(x => x.version >= minVersion);
}
return availableVersions.OrderByDescending(x => x.versionCode);
return availableVersions.OrderByDescending(x => x.version);
}
/// <inheritdoc />
@ -193,9 +193,9 @@ namespace Emby.Server.Implementations.Updates
foreach (var plugin in _applicationHost.Plugins)
{
var compatibleVersions = GetCompatibleVersions(catalog, plugin.Name, plugin.Id, plugin.Version);
var version = compatibleVersions.FirstOrDefault(y => y.versionCode > plugin.Version);
var version = compatibleVersions.FirstOrDefault(y => y.version > plugin.Version);
if (version != null
&& !CompletedInstallations.Any(x => string.Equals(x.AssemblyGuid, version.guid, StringComparison.OrdinalIgnoreCase)))
&& !CompletedInstallations.Any(x => string.Equals(x.Guid, version.guid, StringComparison.OrdinalIgnoreCase)))
{
yield return version;
}
@ -212,10 +212,9 @@ namespace Emby.Server.Implementations.Updates
var installationInfo = new InstallationInfo
{
Id = Guid.NewGuid(),
Guid = package.guid,
Name = package.name,
AssemblyGuid = package.guid,
Version = package.versionString
Version = package.version.ToString()
};
var innerCancellationTokenSource = new CancellationTokenSource();
@ -258,7 +257,7 @@ namespace Emby.Server.Implementations.Updates
_currentInstallations.Remove(tuple);
}
_logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.versionString);
_logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.version);
PackageInstallationCancelled?.Invoke(this, installationEventArgs);
@ -306,13 +305,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);
_logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.version);
PluginInstalled?.Invoke(this, new GenericEventArgs<VersionInfo>(package));
}
else
{
_logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.versionString ?? string.Empty);
_logger.LogInformation("Plugin updated: {0} {1} {2}", package.name, package.version);
PluginUpdated?.Invoke(this, new GenericEventArgs<(IPlugin, VersionInfo)>((plugin, package)));
}
@ -430,7 +429,7 @@ namespace Emby.Server.Implementations.Updates
{
lock (_currentInstallationsLock)
{
var install = _currentInstallations.Find(x => x.info.Id == id);
var install = _currentInstallations.Find(x => x.info.Guid == id.ToString());
if (install == default((InstallationInfo, CancellationTokenSource)))
{
return false;

View File

@ -1,29 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class CheckForUpdateResult.
/// </summary>
public class CheckForUpdateResult
{
/// <summary>
/// Gets or sets a value indicating whether this instance is update available.
/// </summary>
/// <value><c>true</c> if this instance is update available; otherwise, <c>false</c>.</value>
public bool IsUpdateAvailable { get; set; }
/// <summary>
/// Gets or sets the available version.
/// </summary>
/// <value>The available version.</value>
public string AvailableVersion
{
get => Package != null ? Package.versionString : "0.0.0.1";
set { } // need this for the serializer
}
/// <summary>
/// Get or sets package information for an available update
/// </summary>
public VersionInfo Package { get; set; }
}
}

View File

@ -8,10 +8,10 @@ namespace MediaBrowser.Model.Updates
public class InstallationInfo
{
/// <summary>
/// Gets or sets the id.
/// Gets or sets the guid.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <value>The guid.</value>
public string Guid { get; set; }
/// <summary>
/// Gets or sets the name.
@ -19,12 +19,6 @@ namespace MediaBrowser.Model.Updates
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the assembly guid.
/// </summary>
/// <value>The guid of the assembly.</value>
public string AssemblyGuid { get; set; }
/// <summary>
/// Gets or sets the version.
/// </summary>

View File

@ -26,18 +26,6 @@ namespace MediaBrowser.Model.Updates
/// <value>The overview.</value>
public string overview { get; set; }
/// <summary>
/// Gets or sets the thumb image.
/// </summary>
/// <value>The thumb image.</value>
public string thumbImage { get; set; }
/// <summary>
/// Gets or sets the preview image.
/// </summary>
/// <value>The preview image.</value>
public string previewImage { get; set; }
/// <summary>
/// Gets or sets the target filename for the downloaded binary.
/// </summary>

View File

@ -22,17 +22,11 @@ namespace MediaBrowser.Model.Updates
/// <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; }
public Version version { get; set; }
/// <summary>
/// Gets or sets the description.