diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 8d0ee993f..d16afbce3 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -174,9 +174,15 @@ namespace Emby.Common.Implementations } } - public virtual PackageVersionClass SystemUpdateLevel + public PackageVersionClass SystemUpdateLevel { - get { return PackageVersionClass.Release; } + get { + +#if BETA + return PackageVersionClass.Beta; +#endif + return PackageVersionClass.Release; + } } public virtual string OperatingSystemDisplayName diff --git a/Emby.Server.Core/UpdateLevelHelper.cs b/Emby.Server.Core/UpdateLevelHelper.cs deleted file mode 100644 index e6ca37700..000000000 --- a/Emby.Server.Core/UpdateLevelHelper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Updates; - -namespace Emby.Server.Core -{ - public static class UpdateLevelHelper - { - public static PackageVersionClass GetSystemUpdateLevel(IConfigurationManager config) - { - return config.CommonConfiguration.SystemUpdateLevel; - //var configuredValue = ConfigurationManager.AppSettings["SystemUpdateLevel"]; - - //if (string.Equals(configuredValue, "Beta", StringComparison.OrdinalIgnoreCase)) - //{ - // return PackageVersionClass.Beta; - //} - //if (string.Equals(configuredValue, "Dev", StringComparison.OrdinalIgnoreCase)) - //{ - // return PackageVersionClass.Dev; - //} - - //return PackageVersionClass.Release; - } - } -} diff --git a/Emby.Server.Implementations/Migrations/UpdateLevelMigration.cs b/Emby.Server.Implementations/Migrations/UpdateLevelMigration.cs deleted file mode 100644 index c532ea08d..000000000 --- a/Emby.Server.Implementations/Migrations/UpdateLevelMigration.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Common.Net; -using MediaBrowser.Common.Updates; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Updates; - -namespace Emby.Server.Implementations.Migrations -{ - public class UpdateLevelMigration : IVersionMigration - { - private readonly IServerConfigurationManager _config; - private readonly IServerApplicationHost _appHost; - private readonly IHttpClient _httpClient; - private readonly IJsonSerializer _jsonSerializer; - private readonly string _releaseAssetFilename; - private readonly ILogger _logger; - - public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename, ILogger logger) - { - _config = config; - _appHost = appHost; - _httpClient = httpClient; - _jsonSerializer = jsonSerializer; - _releaseAssetFilename = releaseAssetFilename; - _logger = logger; - } - - public async Task Run() - { - var lastVersion = _config.Configuration.LastVersion; - var currentVersion = _appHost.ApplicationVersion; - - if (string.Equals(lastVersion, currentVersion.ToString(), StringComparison.OrdinalIgnoreCase)) - { - return; - } - - try - { - var updateLevel = _config.Configuration.SystemUpdateLevel; - - await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error in update migration", ex); - } - } - - private async Task CheckVersion(Version currentVersion, PackageVersionClass currentUpdateLevel, CancellationToken cancellationToken) - { - var releases = await new GithubUpdater(_httpClient, _jsonSerializer) - .GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false); - - var newUpdateLevel = GetNewUpdateLevel(currentVersion, currentUpdateLevel, releases); - - if (newUpdateLevel != currentUpdateLevel) - { - _config.Configuration.SystemUpdateLevel = newUpdateLevel; - _config.SaveConfiguration(); - } - } - - private PackageVersionClass GetNewUpdateLevel(Version currentVersion, PackageVersionClass currentUpdateLevel, List releases) - { - var newUpdateLevel = currentUpdateLevel; - - // If the current version is later than current stable, set the update level to beta - if (releases.Count >= 1) - { - var release = releases[0]; - var version = ParseVersion(release.tag_name); - if (version != null) - { - if (currentVersion > version) - { - newUpdateLevel = PackageVersionClass.Beta; - } - else - { - return PackageVersionClass.Release; - } - } - } - - // If the current version is later than current beta, set the update level to dev - if (releases.Count >= 2) - { - var release = releases[1]; - var version = ParseVersion(release.tag_name); - if (version != null) - { - if (currentVersion > version) - { - newUpdateLevel = PackageVersionClass.Dev; - } - else - { - return PackageVersionClass.Beta; - } - } - } - - return newUpdateLevel; - } - - private Version ParseVersion(string versionString) - { - if (!string.IsNullOrWhiteSpace(versionString)) - { - var parts = versionString.Split('.'); - if (parts.Length == 3) - { - versionString += ".0"; - } - } - - Version version; - Version.TryParse(versionString, out version); - - return version; - } - } -} diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 873ac3104..4d35531cb 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// Creates the name of the sort. /// /// System.String. - protected override string CreateSortName() + protected override string CreateSortNameInternal() { return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 603e59338..c5422fce9 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -689,14 +689,22 @@ namespace MediaBrowser.Controller.Entities return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString); } + protected string CreateSortName() + { + if (string.IsNullOrWhiteSpace(Name)) + { + return null; + } + + return CreateSortNameInternal(); + } + /// /// Creates the name of the sort. /// /// System.String. - protected virtual string CreateSortName() + protected virtual string CreateSortNameInternal() { - if (Name == null) return null; //some items may not have name filled in properly - if (!EnableAlphaNumericSorting) { return Name.TrimStart(); diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index c2f7a6168..e963ab184 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -237,7 +237,7 @@ namespace MediaBrowser.Controller.Entities.TV /// Creates the name of the sort. /// /// System.String. - protected override string CreateSortName() + protected override string CreateSortNameInternal() { return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "") + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 17494eb08..4ccf6d623 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.TV /// Creates the name of the sort. /// /// System.String. - protected override string CreateSortName() + protected override string CreateSortNameInternal() { return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 6e2fe2495..8a10ae417 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.LiveTv } } - protected override string CreateSortName() + protected override string CreateSortNameInternal() { if (!string.IsNullOrEmpty(Number)) { diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs index c4f9f206d..b5b0101cb 100644 --- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs +++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs @@ -21,11 +21,6 @@ namespace MediaBrowser.Model.Configuration /// true if [enable auto update]; otherwise, false. public bool EnableAutoUpdate { get; set; } - /// - /// Gets of sets a value indicating the level of system updates (Release, Beta, Dev) - /// - public PackageVersionClass SystemUpdateLevel { get; set; } - /// /// The number of days we should retain log files /// diff --git a/MediaBrowser.Server.Mono/MonoAppHost.cs b/MediaBrowser.Server.Mono/MonoAppHost.cs index 09c409a2c..6f438cb72 100644 --- a/MediaBrowser.Server.Mono/MonoAppHost.cs +++ b/MediaBrowser.Server.Mono/MonoAppHost.cs @@ -42,11 +42,6 @@ namespace MediaBrowser.Server.Mono return new SyncManager(); } - public override PackageVersionClass SystemUpdateLevel - { - get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); } - } - protected override void RestartInternal() { MainClass.Restart(StartupOptions); diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index 7ef8e03f7..7a35c5614 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -55,11 +55,6 @@ namespace MediaBrowser.ServerApplication LoopUtil.Run(appName); } - public override PackageVersionClass SystemUpdateLevel - { - get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); } - } - protected override List GetAssembliesWithPartsInternal() { var list = new List(); diff --git a/SharedVersion.cs b/SharedVersion.cs index dad16956c..8211b2539 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.17.19")] +[assembly: AssemblyVersion("3.2.17.20")]