diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index b3b63da151..cc4324e989 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, DateTime> _lastPackageListResult; - + /// /// Gets all available packages. /// /// The cancellation token. - /// Type of the package. - /// The application version. /// Task{List{PackageInfo}}. - public async Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken, - PackageType? packageType = null, - Version applicationVersion = null) + public async Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) { if (_lastPackageListResult != null) { @@ -187,10 +183,26 @@ namespace MediaBrowser.Common.Implementations.Updates var packages = _jsonSerializer.DeserializeFromStream>(json).ToList(); + packages = FilterPackages(packages).ToList(); + _lastPackageListResult = new Tuple, DateTime>(packages, DateTime.UtcNow); - return FilterPackages(packages, packageType, applicationVersion); + return _lastPackageListResult.Item1; + } + } + + protected IEnumerable FilterPackages(List 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 FilterPackages(List packages, PackageType? packageType, Version applicationVersion) diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index 143a90b856..6ef90ac5f4 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. /// /// The cancellation token. - /// Type of the package. - /// The application version. /// Task{List{PackageInfo}}. - Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken, - PackageType? packageType = null, - Version applicationVersion = null); + Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); /// /// Gets the package. diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs index a91dbbe4cf..e1f00951ec 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs @@ -25,7 +25,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// The web socket. private System.Net.WebSockets.WebSocket WebSocket { get; set; } - private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); + private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); /// /// Initializes a new instance of the 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 af32bf8dd9..0513cf965f 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.210 + 3.0.211 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index ccc5368573..ece6a953f6 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.210 + 3.0.211 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index a9aa6e4572..79ee652834 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.210 + 3.0.211 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +