diff options
6 files changed, 26 insertions, 19 deletions
diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index b3b63da15..cc4324e98 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -156,17 +156,13 @@ namespace MediaBrowser.Common.Implementations.Updates } private Tuple<List<PackageInfo>, DateTime> _lastPackageListResult; - + /// <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> - public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken, - PackageType? packageType = null, - Version applicationVersion = null) + public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) { if (_lastPackageListResult != null) { @@ -187,10 +183,26 @@ namespace MediaBrowser.Common.Implementations.Updates var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList(); + packages = FilterPackages(packages).ToList(); + _lastPackageListResult = new Tuple<List<PackageInfo>, DateTime>(packages, DateTime.UtcNow); - return FilterPackages(packages, packageType, applicationVersion); + return _lastPackageListResult.Item1; + } + } + + protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages) + { + foreach (var package in packages) + { + package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl)) + .OrderByDescending(v => v.version).ToList(); } + + // Remove packages with no versions + packages = packages.Where(p => p.versions.Any()).ToList(); + + return packages; } protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, PackageType? packageType, Version applicationVersion) diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index 143a90b85..6ef90ac5f 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -56,12 +56,8 @@ namespace MediaBrowser.Common.Updates /// Gets all available packages from a static resource. /// </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> - Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken, - PackageType? packageType = null, - Version applicationVersion = null); + Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); /// <summary> /// Gets the package. diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs index a91dbbe4c..e1f00951e 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs @@ -25,7 +25,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// <value>The web socket.</value> private System.Net.WebSockets.WebSocket WebSocket { get; set; } - private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); + private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); /// <summary> /// Initializes a new instance of the <see cref="NativeWebSocket" /> class. @@ -168,7 +168,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer if (dispose) { _cancellationTokenSource.Cancel(); - _cancellationTokenSource.Dispose(); WebSocket.Dispose(); } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index af32bf8dd..0513cf965 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.210</version> + <version>3.0.211</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.210" /> + <dependency id="MediaBrowser.Common" version="3.0.211" /> <dependency id="NLog" version="2.0.1.2" /> <dependency id="ServiceStack.Text" version="3.9.58" /> <dependency id="SimpleInjector" version="2.3.2" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index ccc536857..ece6a953f 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.210</version> + <version>3.0.211</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index a9aa6e457..79ee65283 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.210</version> + <version>3.0.211</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.210" /> + <dependency id="MediaBrowser.Common" version="3.0.211" /> </dependencies> </metadata> <files> |
