The Free Software Media System - Server Backend & API
Fix multiple mistakes and warnings
Bond_009c9820d30edf1
diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.csindex 6759ed55ad..3a0c14ffda 100644--- a/BDInfo/BDROM.cs+++ b/BDInfo/BDROM.cs@@ -212,7 +212,6 @@ namespace BDInfopublic void Scan(){- var errorStreamClipFiles = new List<TSStreamClipFile>();foreach (var streamClipFile in StreamClipFiles.Values){try@@ -221,7 +220,6 @@ namespace BDInfo}catch (Exception ex){- errorStreamClipFiles.Add(streamClipFile);if (StreamClipFileScanError != null){if (StreamClipFileScanError(streamClipFile, ex))@@ -250,7 +248,6 @@ namespace BDInfoStreamFiles.Values.CopyTo(streamFiles, 0);Array.Sort(streamFiles, CompareStreamFiles);- var errorPlaylistFiles = new List<TSPlaylistFile>();foreach (var playlistFile in PlaylistFiles.Values){try@@ -259,7 +256,6 @@ namespace BDInfo}catch (Exception ex){- errorPlaylistFiles.Add(playlistFile);if (PlaylistFileScanError != null){if (PlaylistFileScanError(playlistFile, ex))@@ -275,7 +271,6 @@ namespace BDInfo}}- var errorStreamFiles = new List<TSStreamFile>();foreach (var streamFile in streamFiles){try@@ -296,7 +291,6 @@ namespace BDInfo}catch (Exception ex){- errorStreamFiles.Add(streamFile);if (StreamFileScanError != null){if (StreamFileScanError(streamFile, ex))@@ -431,7 +425,7 @@ namespace BDInfo{return 1;}- else if ((x != null || x.FileInfo != null) && (y == null || y.FileInfo == null))+ else if ((x != null && x.FileInfo != null) && (y == null || y.FileInfo == null)){return -1;}@@ -451,6 +445,5 @@ namespace BDInfo}}}-}}diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex 75192a8f1a..a3201f0bc0 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -218,14 +218,12 @@ namespace Emby.Server.Implementations.DtoAttachUserSpecificInfo(dto, item, user, options);}- if (item is IHasMediaSources hasMediaSources)+ if (item is IHasMediaSources+ && options.ContainsField(ItemFields.MediaSources)){- if (options.ContainsField(ItemFields.MediaSources))- {- dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user).ToArray();+ dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user).ToArray();- NormalizeMediaSourceContainers(dto);- }+ NormalizeMediaSourceContainers(dto);}if (options.ContainsField(ItemFields.Studios))diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.csindex 3d3f67ca22..93a61fe67a 100644--- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs+++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.HttpServer.Securityvar user = auth.User;- if (user == null & !auth.UserId.Equals(Guid.Empty))+ if (user == null && auth.UserId != Guid.Empty){throw new SecurityException("User with Id " + auth.UserId + " not found");}diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.csindex f1ae2fc9c0..8bdb387843 100644--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs@@ -57,7 +57,6 @@ namespace Emby.Server.Implementations.Library}var filename = fileInfo.Name;- var path = fileInfo.FullName;// Ignore hidden files on UNIXif (Environment.OSVersion.Platform != PlatformID.Win32NTdiff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.csindex ac6b4a2099..52b2f56ffc 100644--- a/Emby.Server.Implementations/Library/UserManager.cs+++ b/Emby.Server.Implementations/Library/UserManager.cs@@ -273,14 +273,12 @@ namespace Emby.Server.Implementations.Libraryvar user = Users.FirstOrDefault(i => string.Equals(username, i.Name, StringComparison.OrdinalIgnoreCase));var success = false;- string updatedUsername = null;IAuthenticationProvider authenticationProvider = null;if (user != null){var authResult = await AuthenticateLocalUser(username, password, hashedPassword, user, remoteEndPoint).ConfigureAwait(false);authenticationProvider = authResult.authenticationProvider;- updatedUsername = authResult.username;success = authResult.success;}else@@ -288,7 +286,7 @@ namespace Emby.Server.Implementations.Library// user is nullvar authResult = await AuthenticateLocalUser(username, password, hashedPassword, null, remoteEndPoint).ConfigureAwait(false);authenticationProvider = authResult.authenticationProvider;- updatedUsername = authResult.username;+ string updatedUsername = authResult.username;success = authResult.success;if (successdiff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.csindex 4d79cae139..88e2a8fa69 100644--- a/Emby.Server.Implementations/Library/UserViewManager.cs+++ b/Emby.Server.Implementations/Library/UserViewManager.cs@@ -236,7 +236,7 @@ namespace Emby.Server.Implementations.Libraryif (!parentId.Equals(Guid.Empty)){var parentItem = _libraryManager.GetItemById(parentId);- if (parentItem is Channel parentItemChannel)+ if (parentItem is Channel){return _channelManager.GetLatestChannelItemsInternal(new InternalItemsQuery(user)@@ -248,7 +248,7 @@ namespace Emby.Server.Implementations.LibraryIncludeItemTypes = request.IncludeItemTypes,EnableTotalRecordCount = false},- CancellationToken.None).Result.Items;+ CancellationToken.None).GetAwaiter().GetResult().Items;}if (parentItem is Folder parent)diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.csindex 3cc0541e74..cc9c8e5d29 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs@@ -208,9 +208,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate static string GetAudioArgs(MediaSourceInfo mediaSource){- var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();- var inputAudioCodec = mediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).FirstOrDefault() ?? string.Empty;-return "-codec:a:0 copy";//var audioChannels = 2;diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex f5dffc22af..9a4c91d0bd 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -17,7 +17,6 @@ using MediaBrowser.Model.LiveTv;using MediaBrowser.Model.Net;using MediaBrowser.Model.Serialization;using Microsoft.Extensions.Logging;-using Microsoft.Net.Http.Headers;namespace Emby.Server.Implementations.LiveTv.Listings{@@ -41,6 +40,12 @@ namespace Emby.Server.Implementations.LiveTv.Listingsprivate string UserAgent => _appHost.ApplicationUserAgent;+ /// <inheritdoc />+ public string Name => "Schedules Direct";++ /// <inheritdoc />+ public string Type => nameof(SchedulesDirect);+private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc){var dates = new List<string>();@@ -103,7 +108,6 @@ namespace Emby.Server.Implementations.LiveTv.ListingshttpOptions.RequestHeaders["token"] = token;using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))- using (var reader = new StreamReader(response.Content)){var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);@@ -122,7 +126,6 @@ namespace Emby.Server.Implementations.LiveTv.ListingshttpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]";using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))- using (var innerReader = new StreamReader(innerResponse.Content)){var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);var programDict = programDetails.ToDictionary(p => p.programID, y => y);@@ -152,14 +155,14 @@ namespace Emby.Server.Implementations.LiveTv.Listingsvar imagesWithText = allImages.Where(i => string.Equals(i.text, "yes", StringComparison.OrdinalIgnoreCase));var imagesWithoutText = allImages.Where(i => string.Equals(i.text, "no", StringComparison.OrdinalIgnoreCase));- const double desiredAspect = 0.666666667;+ const double DesiredAspect = 2.0 / 3;- programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, desiredAspect) ??- GetProgramImage(ApiUrl, allImages, true, desiredAspect);+ programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, DesiredAspect) ??+ GetProgramImage(ApiUrl, allImages, true, DesiredAspect);- const double wideAspect = 1.77777778;+ const double WideAspect = 16.0 / 9;- programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, wideAspect);+ programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, WideAspect);// Don't supply the same image twiceif (string.Equals(programEntry.primaryImage, programEntry.thumbImage, StringComparison.Ordinal))@@ -167,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsprogramEntry.thumbImage = null;}- programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, wideAspect);+ programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, WideAspect);//programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??// GetProgramImage(ApiUrl, data, "Banner-L1", false) ??@@ -178,6 +181,7 @@ namespace Emby.Server.Implementations.LiveTv.ListingsprogramsInfo.Add(GetProgram(channelId, schedule, programDict[schedule.programID]));}+return programsInfo;}}@@ -185,12 +189,10 @@ namespace Emby.Server.Implementations.LiveTv.Listingsprivate static int GetSizeOrder(ScheduleDirect.ImageData image){- if (!string.IsNullOrWhiteSpace(image.height))+ if (!string.IsNullOrWhiteSpace(image.height)+ && int.TryParse(image.height, out int value)){- if (int.TryParse(image.height, out int value))- {- return value;- }+ return value;}return 0;@@ -736,16 +738,11 @@ namespace Emby.Server.Implementations.LiveTv.ListingshttpOptions.RequestHeaders["token"] = token;- using (var response = await _httpClient.SendAsync(httpOptions, "PUT"))+ using (await _httpClient.SendAsync(httpOptions, "PUT")){}}- public string Name => "Schedules Direct";-- public static string TypeName = "SchedulesDirect";- public string Type => TypeName;-private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken){if (string.IsNullOrEmpty(info.ListingsId))diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex ee975e19a5..89b92c999e 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -60,16 +60,6 @@ namespace Emby.Server.Implementations.LiveTvprivate IListingsProvider[] _listingProviders = Array.Empty<IListingsProvider>();private readonly IFileSystem _fileSystem;- public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;- public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;- public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;- public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated;-- public string GetEmbyTvActiveRecordingPath(string id)- {- return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id);- }-public LiveTvManager(IServerApplicationHost appHost,IServerConfigurationManager config,@@ -102,17 +92,34 @@ namespace Emby.Server.Implementations.LiveTv_tvDtoService = new LiveTvDtoService(dtoService, imageProcessor, loggerFactory, appHost, _libraryManager);}+ public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;++ public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;++ public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;++ public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated;+/// <summary>/// Gets the services./// </summary>/// <value>The services.</value>public IReadOnlyList<ILiveTvService> Services => _services;+ public ITunerHost[] TunerHosts => _tunerHosts;++ public IListingsProvider[] ListingProviders => _listingProviders;+private LiveTvOptions GetConfiguration(){return _config.GetConfiguration<LiveTvOptions>("livetv");}+ public string GetEmbyTvActiveRecordingPath(string id)+ {+ return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id);+ }+/// <summary>/// Adds the parts./// </summary>@@ -130,13 +137,13 @@ namespace Emby.Server.Implementations.LiveTv{if (service is EmbyTV.EmbyTV embyTv){- embyTv.TimerCreated += EmbyTv_TimerCreated;- embyTv.TimerCancelled += EmbyTv_TimerCancelled;+ embyTv.TimerCreated += OnEmbyTvTimerCreated;+ embyTv.TimerCancelled += OnEmbyTvTimerCancelled;}}}- private void EmbyTv_TimerCancelled(object sender, GenericEventArgs<string> e)+ private void OnEmbyTvTimerCancelled(object sender, GenericEventArgs<string> e){var timerId = e.Argument;@@ -149,10 +156,9 @@ namespace Emby.Server.Implementations.LiveTv});}- private void EmbyTv_TimerCreated(object sender, GenericEventArgs<TimerInfo> e)+ private void OnEmbyTvTimerCreated(object sender, GenericEventArgs<TimerInfo> e){var timer = e.Argument;- var service = sender as ILiveTvService;TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>{@@ -164,10 +170,6 @@ namespace Emby.Server.Implementations.LiveTv});}- public ITunerHost[] TunerHosts => _tunerHosts;-- public IListingsProvider[] ListingProviders => _listingProviders;-public List<NameIdPair> GetTunerHostTypes(){return _tunerHosts.OrderBy(i => i.Name).Select(i => new NameIdPair@@ -966,9 +968,6 @@ namespace Emby.Server.Implementations.LiveTvprivate async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string>> programs, CancellationToken cancellationToken){- var timers = new Dictionary<string, List<TimerInfo>>();- var seriesTimers = new Dictionary<string, List<SeriesTimerInfo>>();-IReadOnlyList<TimerInfo> timerList = null;IReadOnlyList<SeriesTimerInfo> seriesTimerList = null;@@ -1601,8 +1600,6 @@ namespace Emby.Server.Implementations.LiveTvif (!string.IsNullOrEmpty(query.Id)){- var guid = new Guid(query.Id);-timers = timers.Where(i => string.Equals(_tvDtoService.GetInternalTimerId(i.Item1.Id), query.Id, StringComparison.OrdinalIgnoreCase));}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.csindex 3699b988c6..9702392b29 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs@@ -424,14 +424,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunreturn false;}- var nameTag = buf[offset++];+ offset++; // Name Tagvar nameLength = buf[offset++];// skip the name field to get to value for returnoffset += nameLength;- var valueTag = buf[offset++];+ offset++; // Value Tagvar valueLength = buf[offset++];diff --git a/Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs b/Emby.Server.Implementations/Services/StringMapTypeDeserializer.csindex c27eb76865..23e22afd58 100644--- a/Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs+++ b/Emby.Server.Implementations/Services/StringMapTypeDeserializer.cs@@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Services{PropertySetFn = propertySetFn;PropertyParseStringFn = propertyParseStringFn;- PropertyType = PropertyType;+ PropertyType = propertyType;}public Action<object, object> PropertySetFn { get; private set; }diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csprojindex 35f0c84cbe..fa3e9cb35d 100644--- a/Jellyfin.Server/Jellyfin.Server.csproj+++ b/Jellyfin.Server/Jellyfin.Server.csproj@@ -22,7 +22,7 @@<EmbeddedResource Include="Resources/Configuration/*" /></ItemGroup>- <!-- Code analysers-->+ <!-- Code analyzers--><ItemGroup Condition=" '$(Configuration)' == 'Debug' "><PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" /><PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.csindex ada540ba6a..b4a3026480 100644--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs@@ -455,9 +455,7 @@ namespace MediaBrowser.Api.UserLibraryIncludeItemTypes = new[] { typeof(MusicAlbum).Name },Name = i,Limit = 1-- }).Select(albumId => albumId);-+ });}).ToArray();}diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.csindex 40c16b9573..33473c2be7 100644--- a/MediaBrowser.Common/Extensions/BaseExtensions.cs+++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs@@ -14,20 +14,20 @@ namespace MediaBrowser.Common.Extensions/// Strips the HTML./// </summary>/// <param name="htmlString">The HTML string.</param>- /// <returns>System.String.</returns>+ /// <returns><see cref="string" />.</returns>public static string StripHtml(this string htmlString){// http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net- const string pattern = @"<(.|\n)*?>";+ const string Pattern = @"<(.|\n)*?>";- return Regex.Replace(htmlString, pattern, string.Empty).Trim();+ return Regex.Replace(htmlString, Pattern, string.Empty).Trim();}/// <summary>- /// Gets the M d5.+ /// Gets the Md5./// </summary>- /// <param name="str">The STR.</param>- /// <returns>Guid.</returns>+ /// <param name="str">The string.</param>+ /// <returns><see cref="Guid" />.</returns>public static Guid GetMD5(this string str){using (var provider = MD5.Create())diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.csindex 3bc0295a02..75b9f59f87 100644--- a/MediaBrowser.Common/Extensions/CollectionExtensions.cs+++ b/MediaBrowser.Common/Extensions/CollectionExtensions.cs@@ -5,13 +5,28 @@ namespace MediaBrowser.Common.Extensions// The MS CollectionExtensions are only available in netcoreapppublic static class CollectionExtensions{- public static TValue GetValueOrDefault<TKey, TValue> (this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)+ public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key){dictionary.TryGetValue(key, out var ret);return ret;}- // REVIEW: Inline?+ /// <summary>+ /// Copies all the elements of the current collection to the specified list+ /// starting at the specified destination array index. The index is specified as a 32-bit integer.+ /// </summary>+ /// <param name="source">The current collection that is the source of the elements.</param>+ /// <param name="destination">The list that is the destination of the elements copied from the current collection.</param>+ /// <param name="index">A 32-bit integer that represents the index in <c>destination</c> at which copying begins.</param>+ /// <typeparam name="T"></typeparam>+ public static void CopyTo<T>(this IReadOnlyList<T> source, IList<T> destination, int index = 0)+ {+ for (int i = 0; i < source.Count; i++)+ {+ destination[index + i] = source[i];+ }+ }+/// <summary>/// Copies all the elements of the current collection to the specified list/// starting at the specified destination array index. The index is specified as a 32-bit integer.diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 0e9f7ee443..369f63b13d 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -2045,7 +2045,7 @@ namespace MediaBrowser.Controller.Entitiesif (itemByPath == null){- //Logger.LogWarning("Unable to find linked item at path {0}", info.Path);+ Logger.LogWarning("Unable to find linked item at path {0}", info.Path);}return itemByPath;@@ -2057,7 +2057,7 @@ namespace MediaBrowser.Controller.Entitiesif (item == null){- //Logger.LogWarning("Unable to find linked item at path {0}", info.Path);+ Logger.LogWarning("Unable to find linked item at path {0}", info.Path);}return item;@@ -2085,14 +2085,17 @@ namespace MediaBrowser.Controller.Entitiesif (!current.Contains(name, StringComparer.OrdinalIgnoreCase)){- if (current.Length == 0)+ int curLen = current.Length;+ if (curLen == 0){Studios = new[] { name };}else{- var list =- Studios = current.Concat(new[] { name }).ToArray();+ var newArr = new string[curLen + 1];+ current.CopyTo(newArr, 0);+ newArr[curLen] = name;+ Studios = newArr;}}}@@ -2231,8 +2234,12 @@ namespace MediaBrowser.Controller.Entitieselse{- var currentCount = ImageInfos.Length;- ImageInfos = ImageInfos.Concat(new[] { image }).ToArray();+ var current = ImageInfos;+ var currentCount = current.Length;+ var newArr = new ItemImageInfo[currentCount + 1];+ current.CopyTo(newArr, 0);+ current[currentCount] = image;+ ImageInfos = current;}}diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex 841205d0ce..eb3d2ab810 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -1252,9 +1252,6 @@ namespace MediaBrowser.Controller.MediaEncoding{if (request.AudioBitRate.HasValue){- // Make sure we don't request a bitrate higher than the source- var currentBitrate = audioStream == null ? request.AudioBitRate.Value : audioStream.BitRate ?? request.AudioBitRate.Value;-// Don't encode any higher than thisreturn Math.Min(384000, request.AudioBitRate.Value);}diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.csindex 19009e5771..bd727bcdf9 100644--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs@@ -158,8 +158,6 @@ namespace MediaBrowser.LocalMetadata.Savers/// <returns>Task.</returns>public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataRepo, IFileSystem fileSystem, IServerConfigurationManager config){- var writtenProviderIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);-if (!string.IsNullOrEmpty(item.OfficialRating)){writer.WriteElementString("ContentRating", item.OfficialRating);diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex 9ddfb9b01e..d5fa76c3ab 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -506,12 +506,12 @@ namespace MediaBrowser.MediaEncoding.Subtitlesif (failed){- var msg = string.Format("ffmpeg subtitle conversion failed for {Path}", inputPath);+ _logger.LogError("ffmpeg subtitle conversion failed for {Path}", inputPath);- _logger.LogError(msg);-- throw new Exception(msg);+ throw new Exception(+ string.Format(CultureInfo.InvariantCulture, "ffmpeg subtitle conversion failed for {0}", inputPath));}+await SetAssFont(outputPath).ConfigureAwait(false);_logger.LogInformation("ffmpeg subtitle conversion succeeded for {Path}", inputPath);diff --git a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.csindex aa28fded11..091c1957eb 100644--- a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs+++ b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs@@ -31,7 +31,7 @@ namespace MediaBrowser.XbmcMetadata.Savers/// <inheritdoc />public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)- => !item.SupportsLocalMetadata && item is Episode && updateType >= MinimumUpdateType;+ => item.SupportsLocalMetadata && item is Episode && updateType >= MinimumUpdateType;/// <inheritdoc />protected override void WriteCustomElements(BaseItem item, XmlWriter writer)diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.csindex 7f3e56394b..53b740052b 100644--- a/RSSDP/SsdpDevicePublisher.cs+++ b/RSSDP/SsdpDevicePublisher.cs@@ -86,7 +86,6 @@ namespace Rssdp.InfrastructureThrowIfDisposed();- var minCacheTime = TimeSpan.Zero;bool wasAdded = false;lock (_Devices){@@ -94,7 +93,6 @@ namespace Rssdp.Infrastructure{_Devices.Add(device);wasAdded = true;- minCacheTime = GetMinimumNonZeroCacheLifetime();}}@@ -120,14 +118,12 @@ namespace Rssdp.Infrastructureif (device == null) throw new ArgumentNullException(nameof(device));bool wasRemoved = false;- var minCacheTime = TimeSpan.Zero;lock (_Devices){if (_Devices.Contains(device)){_Devices.Remove(device);wasRemoved = true;- minCacheTime = GetMinimumNonZeroCacheLifetime();}}