From c30036d9cf265c555eefedb5cf1453c3b45959e1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 Jan 2015 19:49:22 -0500 Subject: [PATCH] 3.0.5482.1 --- .../Encoder/EncodingJobFactory.cs | 43 ++++++++----------- MediaBrowser.Model/LiveTv/ProgramInfoDto.cs | 12 +++--- .../Library/UserManager.cs | 40 +++++++++-------- .../Sync/SyncJobProcessor.cs | 8 ++-- SharedVersion.cs | 2 +- 5 files changed, 53 insertions(+), 52 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index 00c7b61e3..925d17bc6 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -556,33 +556,28 @@ namespace MediaBrowser.MediaEncoding.Encoder { var codec = request.VideoCodec; - if (!string.IsNullOrEmpty(codec)) + if (string.Equals(codec, "h264", StringComparison.OrdinalIgnoreCase)) { - if (string.Equals(codec, "h264", StringComparison.OrdinalIgnoreCase)) - { - return "libx264"; - } - if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase)) - { - return "libx265"; - } - if (string.Equals(codec, "vpx", StringComparison.OrdinalIgnoreCase)) - { - return "libvpx"; - } - if (string.Equals(codec, "wmv", StringComparison.OrdinalIgnoreCase)) - { - return "wmv2"; - } - if (string.Equals(codec, "theora", StringComparison.OrdinalIgnoreCase)) - { - return "libtheora"; - } - - return codec.ToLower(); + return "libx264"; + } + if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase)) + { + return "libx265"; + } + if (string.Equals(codec, "vpx", StringComparison.OrdinalIgnoreCase)) + { + return "libvpx"; + } + if (string.Equals(codec, "wmv", StringComparison.OrdinalIgnoreCase)) + { + return "wmv2"; + } + if (string.Equals(codec, "theora", StringComparison.OrdinalIgnoreCase)) + { + return "libtheora"; } - return "copy"; + return (codec ?? string.Empty).ToLower(); } internal static bool CanStreamCopyVideo(EncodingJobOptions request, MediaStream videoStream) diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 97cd91b2c..f511a7a17 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -1,12 +1,12 @@ -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.Serialization; -using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Library; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.Serialization; namespace MediaBrowser.Model.LiveTv { diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 503af4970..3b6de5998 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -160,10 +160,25 @@ namespace MediaBrowser.Server.Implementations.Library { Users = await LoadUsers().ConfigureAwait(false); - foreach (var user in Users.ToList()) + var users = Users.ToList(); + + foreach (var user in users) { await DoPolicyMigration(user).ConfigureAwait(false); } + + // If there are no local users with admin rights, make them all admins + if (!users.Any(i => i.Policy.IsAdministrator)) + { + foreach (var user in users) + { + if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value == UserLinkType.LinkedUser) + { + user.Policy.IsAdministrator = true; + await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false); + } + } + } } public Task AuthenticateUser(string username, string passwordSha1, string remoteEndPoint) @@ -331,7 +346,7 @@ namespace MediaBrowser.Server.Implementations.Library user.Policy.IsHidden = user.Configuration.IsHidden; user.Policy.MaxParentalRating = user.Configuration.MaxParentalRating; - await UpdateUserPolicy(user.Id.ToString("N"), user.Policy); + await UpdateUserPolicy(user, user.Policy, false); user.Configuration.HasMigratedToPolicy = true; await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false); @@ -867,12 +882,6 @@ namespace MediaBrowser.Server.Implementations.Library userPolicy = _jsonSerializer.DeserializeFromString(json); } - var updateConfig = user.Policy.IsAdministrator != userPolicy.IsAdministrator || - user.Policy.EnableLiveTvManagement != userPolicy.EnableLiveTvManagement || - user.Policy.EnableLiveTvAccess != userPolicy.EnableLiveTvAccess || - user.Policy.EnableMediaPlayback != userPolicy.EnableMediaPlayback || - user.Policy.EnableContentDeletion != userPolicy.EnableContentDeletion; - var path = GetPolifyFilePath(user); Directory.CreateDirectory(Path.GetDirectoryName(path)); @@ -883,16 +892,13 @@ namespace MediaBrowser.Server.Implementations.Library user.Policy = userPolicy; } - if (updateConfig) - { - user.Configuration.IsAdministrator = user.Policy.IsAdministrator; - user.Configuration.EnableLiveTvManagement = user.Policy.EnableLiveTvManagement; - user.Configuration.EnableLiveTvAccess = user.Policy.EnableLiveTvAccess; - user.Configuration.EnableMediaPlayback = user.Policy.EnableMediaPlayback; - user.Configuration.EnableContentDeletion = user.Policy.EnableContentDeletion; + user.Configuration.IsAdministrator = user.Policy.IsAdministrator; + user.Configuration.EnableLiveTvManagement = user.Policy.EnableLiveTvManagement; + user.Configuration.EnableLiveTvAccess = user.Policy.EnableLiveTvAccess; + user.Configuration.EnableMediaPlayback = user.Policy.EnableMediaPlayback; + user.Configuration.EnableContentDeletion = user.Policy.EnableContentDeletion; - await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false); - } + await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false); } private void DeleteUserPolicy(User user) diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs index 896e49cb2..7a363c54a 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs @@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.Sync private readonly ILogger _logger; private readonly IUserManager _userManager; private readonly ITVSeriesManager _tvSeriesManager; - private readonly IMediaEncoder MediaEncoder; + private readonly IMediaEncoder _mediaEncoder; public SyncJobProcessor(ILibraryManager libraryManager, ISyncRepository syncRepo, ISyncManager syncManager, ILogger logger, IUserManager userManager, ITVSeriesManager tvSeriesManager, IMediaEncoder mediaEncoder) { @@ -39,7 +39,7 @@ namespace MediaBrowser.Server.Implementations.Sync _logger = logger; _userManager = userManager; _tvSeriesManager = tvSeriesManager; - MediaEncoder = mediaEncoder; + _mediaEncoder = mediaEncoder; } public async Task EnsureJobItems(SyncJob job) @@ -412,7 +412,7 @@ namespace MediaBrowser.Server.Implementations.Sync jobItem.Status = SyncJobItemStatus.Converting; await _syncRepo.Update(jobItem).ConfigureAwait(false); - jobItem.OutputPath = await MediaEncoder.EncodeVideo(new EncodingJobOptions(streamInfo, profile), new Progress(), cancellationToken); + jobItem.OutputPath = await _mediaEncoder.EncodeVideo(new EncodingJobOptions(streamInfo, profile), new Progress(), cancellationToken); } else { @@ -456,7 +456,7 @@ namespace MediaBrowser.Server.Implementations.Sync jobItem.Status = SyncJobItemStatus.Converting; await _syncRepo.Update(jobItem).ConfigureAwait(false); - jobItem.OutputPath = await MediaEncoder.EncodeAudio(new EncodingJobOptions(streamInfo, profile), new Progress(), cancellationToken); + jobItem.OutputPath = await _mediaEncoder.EncodeAudio(new EncodingJobOptions(streamInfo, profile), new Progress(), cancellationToken); } else { diff --git a/SharedVersion.cs b/SharedVersion.cs index eebcb54b1..d53462b93 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5482.0")] +[assembly: AssemblyVersion("3.0.5482.1")]