diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index d2f635e56..81c4d3d16 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -932,13 +932,7 @@ namespace Emby.Dlna.Didl private void AddCover(BaseItem item, BaseItem context, StubType? stubType, XmlWriter writer) { - ImageDownloadInfo imageInfo = null; - - // Finally, just use the image from the item - if (imageInfo == null) - { - imageInfo = GetImageInfo(item); - } + ImageDownloadInfo imageInfo = GetImageInfo(item);; if (imageInfo == null) { diff --git a/Emby.Drawing/SkiaEncoder.cs b/Emby.Drawing/SkiaEncoder.cs index 87e0eca21..9883b3cca 100644 --- a/Emby.Drawing/SkiaEncoder.cs +++ b/Emby.Drawing/SkiaEncoder.cs @@ -270,17 +270,10 @@ namespace Emby.Drawing // create the bitmap var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height, !requiresTransparencyHack); - if (bitmap != null) - { - // decode - codec.GetPixels(bitmap.Info, bitmap.GetPixels()); + // decode + codec.GetPixels(bitmap.Info, bitmap.GetPixels()); - origin = codec.EncodedOrigin; - } - else - { - origin = GetSKEncodedOrigin(orientation); - } + origin = codec.EncodedOrigin; return bitmap; } diff --git a/Emby.Naming/AudioBook/AudioBookResolver.cs b/Emby.Naming/AudioBook/AudioBookResolver.cs index f8f13bc5e..67451a639 100644 --- a/Emby.Naming/AudioBook/AudioBookResolver.cs +++ b/Emby.Naming/AudioBook/AudioBookResolver.cs @@ -30,8 +30,11 @@ namespace Emby.Naming.AudioBook { throw new ArgumentNullException(nameof(path)); } - if (IsDirectory) + + if (IsDirectory) // TODO + { return null; + } var extension = Path.GetExtension(path) ?? string.Empty; // Check supported extensions diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 660547c85..a306b0169 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -681,22 +681,17 @@ namespace Emby.Server.Implementations.Channels // Find the corresponding channel provider plugin var channelProvider = GetChannelProvider(channel); - var user = query.User; - - ChannelItemSortField? sortField = null; - var sortDescending = false; - - var parentItem = !query.ParentId.Equals(Guid.Empty) ? _libraryManager.GetItemById(query.ParentId) : channel; + var parentItem = query.ParentId == Guid.Empty ? channel : _libraryManager.GetItemById(query.ParentId); var itemsResult = await GetChannelItems(channelProvider, - user, + query.User, parentItem is Channel ? null : parentItem.ExternalId, - sortField, - sortDescending, + null, + false, cancellationToken) .ConfigureAwait(false); - if (query.ParentId.Equals(Guid.Empty)) + if (query.ParentId == Guid.Empty) { query.Parent = channel; } diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 0adc5553b..1ed838893 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -469,7 +469,7 @@ namespace Emby.Server.Implementations.Library } // TODO: Don't hardcode this - var isAudio = false; + const bool isAudio = false; try { @@ -480,9 +480,11 @@ namespace Emby.Server.Implementations.Library else { // hack - these two values were taken from LiveTVMediaSourceProvider - var cacheKey = request.OpenToken; + string cacheKey = request.OpenToken; - await new LiveStreamHelper(_mediaEncoder(), _logger, _jsonSerializer, _appPaths).AddMediaInfoWithProbe(mediaSource, isAudio, cacheKey, true, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder(), _logger, _jsonSerializer, _appPaths) + .AddMediaInfoWithProbe(mediaSource, isAudio, cacheKey, true, cancellationToken) + .ConfigureAwait(false); } } catch (Exception ex) @@ -491,6 +493,7 @@ namespace Emby.Server.Implementations.Library AddMediaInfo(mediaSource, isAudio); } + // TODO: @bond Fix var json = _jsonSerializer.SerializeToString(mediaSource); _logger.LogInformation("Live stream opened: " + json); var clone = _jsonSerializer.DeserializeFromString(json); diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs index baa665fce..e39192d28 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs @@ -86,12 +86,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio .Where(i => !LibraryManager.IgnoreFile(i, args.Parent)) .ToList(); - if (isBooksCollectionType) - { - return FindAudio(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false); - } - - return null; + return FindAudio(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false); } if (LibraryManager.IsAudioFile(args.Path, libraryOptions)) @@ -145,36 +140,19 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio private T FindAudio(ItemResolveArgs args, string path, Folder parent, List fileSystemEntries, IDirectoryService directoryService, string collectionType, bool parseName) where T : MediaBrowser.Controller.Entities.Audio.Audio, new() { - var multiDiscFolders = new List(); - - var libraryOptions = args.GetLibraryOptions(); - var filesFromOtherItems = new List(); - // TODO: Allow GetMultiDiscMovie in here - var supportsMultiVersion = false; + const bool supportsMultiVersion = false; var result = ResolveMultipleAudio(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType, parseName) ?? new MultiItemResolverResult(); if (result.Items.Count == 1) { - var videoPath = result.Items[0].Path; - // If we were supporting this we'd be checking filesFromOtherItems - var hasOtherItems = false; - - if (!hasOtherItems) - { - var item = (T)result.Items[0]; - item.IsInMixedFolder = false; - item.Name = Path.GetFileName(item.ContainingFolderPath); - return item; - } - } - - if (result.Items.Count == 0 && multiDiscFolders.Count > 0) - { - //return GetMultiDiscAudio(multiDiscFolders, directoryService); + var item = (T)result.Items[0]; + item.IsInMixedFolder = false; + item.Name = Path.GetFileName(item.ContainingFolderPath); + return item; } return null; @@ -194,11 +172,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio { leftOver.Add(child); } - else if (IsIgnored(child.Name)) - { - - } - else + else if (!IsIgnored(child.Name)) { files.Add(child); } diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index e48213dbb..472a3f105 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -410,7 +410,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies } // TODO: Allow GetMultiDiscMovie in here - var supportsMultiVersion = true; + const bool supportsMultiVersion = true; var result = ResolveVideos(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType, parseName) ?? new MultiItemResolverResult(); diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 8ef227689..5c95534ec 100644 --- a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -153,16 +153,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions(); var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions); - bool? isNamed = null; - bool? isOptimistic = null; - if (!isTvContentType) - { - isNamed = true; - isOptimistic = false; - } - - var episodeInfo = episodeResolver.Resolve(fullName, false, isNamed, isOptimistic, fillExtendedInfo: false); + var episodeInfo = episodeResolver.Resolve(fullName, false, true, false, fillExtendedInfo: false); if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue) { return true; diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index d5bc3d332..6139659b7 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -322,17 +322,14 @@ namespace Emby.Server.Implementations.Library throw new SecurityException(string.Format("The {0} account is currently disabled. Please consult with your administrator.", user.Name)); } - if (user != null) + if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(remoteEndPoint)) { - if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(remoteEndPoint)) - { - throw new SecurityException("Forbidden."); - } + throw new SecurityException("Forbidden."); + } - if (!user.IsParentalScheduleAllowed()) - { - throw new SecurityException("User is not allowed access at this time."); - } + if (!user.IsParentalScheduleAllowed()) + { + throw new SecurityException("User is not allowed access at this time."); } // Update LastActivityDate and LastLoginDate, then save @@ -463,26 +460,26 @@ namespace Emby.Server.Implementations.Library { user.Policy.InvalidLoginAttemptCount = newValue; - var maxCount = user.Policy.IsAdministrator ? - 3 : - 5; + var maxCount = user.Policy.IsAdministrator ? 3 : 5; + // TODO: Fix + /* var fireLockout = false; if (newValue >= maxCount) { - //_logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); - //user.Policy.IsDisabled = true; + _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); + user.Policy.IsDisabled = true; - //fireLockout = true; - } + fireLockout = true; + }*/ UpdateUserPolicy(user, user.Policy, false); - if (fireLockout) + /* if (fireLockout) { UserLockedOut?.Invoke(this, new GenericEventArgs(user)); - } + }*/ } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 64e5affd7..9e11494c9 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1133,8 +1133,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV IgnoreIndex = true }; - var isAudio = false; - await new LiveStreamHelper(_mediaEncoder, _logger, _jsonSerializer, _config.CommonApplicationPaths).AddMediaInfoWithProbe(stream, isAudio, false, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder, _logger, _jsonSerializer, _config.CommonApplicationPaths) + .AddMediaInfoWithProbe(stream, false, false, cancellationToken).ConfigureAwait(false); return new List { @@ -1149,12 +1149,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public Task RecordLiveStream(string id, CancellationToken cancellationToken) { - return Task.FromResult(0); + return Task.CompletedTask; } public Task ResetTuner(string id, CancellationToken cancellationToken) { - return Task.FromResult(0); + return Task.CompletedTask; } async void _timerProvider_TimerFired(object sender, GenericEventArgs e) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index c09ee9348..c11a85027 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -175,12 +175,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV } var videoStream = mediaSource.VideoStream; - string videoDecoder = null; - - if (!string.IsNullOrEmpty(videoDecoder)) - { - inputModifier += " " + videoDecoder; - } if (mediaSource.ReadAtNativeFramerate) { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index e8e4bc723..77b09a83d 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -354,10 +354,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun int? height = null; bool isInterlaced = true; string videoCodec = null; - string audioCodec = null; int? videoBitrate = null; - int? audioBitrate = null; var isHd = channelInfo.IsHD ?? true; @@ -427,20 +425,17 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun } } - if (channelInfo != null) + if (string.IsNullOrWhiteSpace(videoCodec)) { - if (string.IsNullOrWhiteSpace(videoCodec)) - { - videoCodec = channelInfo.VideoCodec; - } - audioCodec = channelInfo.AudioCodec; - - if (!videoBitrate.HasValue) - { - videoBitrate = isHd ? 15000000 : 2000000; - } - audioBitrate = isHd ? 448000 : 192000; + videoCodec = channelInfo.VideoCodec; } + string audioCodec = channelInfo.AudioCodec; + + if (!videoBitrate.HasValue) + { + videoBitrate = isHd ? 15000000 : 2000000; + } + int? audioBitrate = isHd ? 448000 : 192000; // normalize if (string.Equals(videoCodec, "mpeg2", StringComparison.OrdinalIgnoreCase))