Minor improvements

This commit is contained in:
Bond_009 2019-08-11 15:57:36 +02:00
parent 5eaf5465a5
commit 7243689215
3 changed files with 3 additions and 9 deletions

View file

@ -279,12 +279,7 @@ namespace Emby.Server.Implementations.Updates
var package = availablePackages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase))
?? availablePackages.FirstOrDefault(p => p.name.Equals(name, StringComparison.OrdinalIgnoreCase));
if (package == null)
{
return null;
}
return package.versions
return package?.versions
.OrderByDescending(x => x.Version)
.FirstOrDefault(v => v.classification <= classification && IsPackageVersionUpToDate(v, currentServerVersion));
}
@ -308,7 +303,6 @@ namespace Emby.Server.Implementations.Updates
var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, systemUpdateLevel);
return latestPluginInfo != null && latestPluginInfo.Version > p.Version ? latestPluginInfo : null;
}).Where(i => i != null)
.Where(p => !string.IsNullOrEmpty(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase)));
}

View file

@ -197,7 +197,7 @@ namespace MediaBrowser.Api
throw new ResourceNotFoundException(string.Format("Package not found: {0}", request.Name));
}
await _installationManager.InstallPackage(package, CancellationToken.None);
await _installationManager.InstallPackage(package);
}
/// <summary>

View file

@ -99,7 +99,7 @@ namespace MediaBrowser.Common.Updates
/// <param name="package">The package.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="Task" />.</returns>
Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken);
Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken = default);
/// <summary>
/// Uninstalls a plugin