diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index 423fe7b18..e28acd769 100644 --- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs +++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs @@ -136,19 +136,15 @@ namespace Emby.Common.Implementations.Serialization return ServiceStack.Text.JsonSerializer.DeserializeFromStream(stream); } - public async Task DeserializeFromStreamAsync(Stream stream) + public Task DeserializeFromStreamAsync(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } - using (var reader = new StreamReader(stream)) - { - var json = await reader.ReadToEndAsync().ConfigureAwait(false); - return ServiceStack.Text.JsonSerializer.DeserializeFromString(json); - } + return ServiceStack.Text.JsonSerializer.DeserializeFromStreamAsync(stream); } /// diff --git a/MediaBrowser.Common/Updates/GithubUpdater.cs b/MediaBrowser.Common/Updates/GithubUpdater.cs index 4275799a9..22ed788e0 100644 --- a/MediaBrowser.Common/Updates/GithubUpdater.cs +++ b/MediaBrowser.Common/Updates/GithubUpdater.cs @@ -41,13 +41,11 @@ namespace MediaBrowser.Common.Updates } using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false)) + using (var stream = response.Content) { - using (var stream = response.Content) - { - var obj = _jsonSerializer.DeserializeFromStream(stream); + var obj = await _jsonSerializer.DeserializeFromStreamAsync(stream).ConfigureAwait(false); - return CheckForUpdateResult(obj, minVersion, updateLevel, assetFilename, packageName, targetFilename); - } + return CheckForUpdateResult(obj, minVersion, updateLevel, assetFilename, packageName, targetFilename); } } @@ -114,19 +112,17 @@ namespace MediaBrowser.Common.Updates }; using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false)) + using (var stream = response.Content) { - using (var stream = response.Content) - { - var obj = _jsonSerializer.DeserializeFromStream(stream); + var obj = await _jsonSerializer.DeserializeFromStreamAsync(stream).ConfigureAwait(false); - obj = obj.Where(i => (i.assets ?? new List()).Any(a => IsAsset(a, assetFilename, i.tag_name))).ToArray(); + obj = obj.Where(i => (i.assets ?? new List()).Any(a => IsAsset(a, assetFilename, i.tag_name))).ToArray(); - list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Release)).OrderByDescending(GetVersion).Take(1)); - list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Beta)).OrderByDescending(GetVersion).Take(1)); - list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Dev)).OrderByDescending(GetVersion).Take(1)); + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Release)).OrderByDescending(GetVersion).Take(1)); + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Beta)).OrderByDescending(GetVersion).Take(1)); + list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Dev)).OrderByDescending(GetVersion).Take(1)); - return list; - } + return list; } } diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index e4c417c8a..3d006a699 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -1,11 +1,10 @@ -using MediaBrowser.Controller.Providers; +using System; +using System.Collections.Generic; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; -using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 7333149c2..befbb2140 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -11,13 +11,10 @@ namespace MediaBrowser.Controller.MediaEncoding { public string OutputDirectory { get; set; } - public string DeviceId { get; set; } public string ItemId { get; set; } public string MediaSourceId { get; set; } public string AudioCodec { get; set; } - public DeviceProfile DeviceProfile { get; set; } - public bool ReadInputAtNativeFramerate { get; set; } /// diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index e97898ac5..9761de98f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -1,18 +1,10 @@ -using MediaBrowser.Controller.Library; +using System; +using System.IO; +using System.Threading.Tasks; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Dlna; -using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Net; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; namespace MediaBrowser.MediaEncoding.Encoder @@ -153,7 +145,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { var ticks = transcodingPosition.HasValue ? transcodingPosition.Value.Ticks : (long?)null; - // job.Framerate = framerate; + //job.Framerate = framerate; if (!percentComplete.HasValue && ticks.HasValue && RunTimeTicks.HasValue) { @@ -166,8 +158,9 @@ namespace MediaBrowser.MediaEncoding.Encoder Progress.Report(percentComplete.Value); } - // job.TranscodingPositionTicks = ticks; - // job.BytesTranscoded = bytesTranscoded; + /* + job.TranscodingPositionTicks = ticks; + job.BytesTranscoded = bytesTranscoded; var deviceId = Options.DeviceId; @@ -176,21 +169,21 @@ namespace MediaBrowser.MediaEncoding.Encoder var audioCodec = ActualOutputVideoCodec; var videoCodec = ActualOutputVideoCodec; - // SessionManager.ReportTranscodingInfo(deviceId, new TranscodingInfo - // { - // Bitrate = job.TotalOutputBitrate, - // AudioCodec = audioCodec, - // VideoCodec = videoCodec, - // Container = job.Options.OutputContainer, - // Framerate = framerate, - // CompletionPercentage = percentComplete, - // Width = job.OutputWidth, - // Height = job.OutputHeight, - // AudioChannels = job.OutputAudioChannels, - // IsAudioDirect = string.Equals(job.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase), - // IsVideoDirect = string.Equals(job.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) - // }); - } + SessionManager.ReportTranscodingInfo(deviceId, new TranscodingInfo + { + Bitrate = job.TotalOutputBitrate, + AudioCodec = audioCodec, + VideoCodec = videoCodec, + Container = job.Options.OutputContainer, + Framerate = framerate, + CompletionPercentage = percentComplete, + Width = job.OutputWidth, + Height = job.OutputHeight, + AudioChannels = job.OutputAudioChannels, + IsAudioDirect = string.Equals(job.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase), + IsVideoDirect = string.Equals(job.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) + }); + }*/ } } } diff --git a/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs b/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs index d2cf7f395..c62de0b11 100644 --- a/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs +++ b/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs @@ -3,15 +3,12 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using MediaBrowser.Model.IO; using MediaBrowser.Common.Configuration; - using MediaBrowser.Common.Net; using MediaBrowser.Common.Progress; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Net; +using Microsoft.Extensions.Logging; namespace MediaBrowser.MediaEncoding.Encoder { diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index a661d7691..181fc0f65 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -6,7 +6,6 @@ using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Session; using MediaBrowser.MediaEncoding.Probing; using MediaBrowser.Model.Dlna; -using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; @@ -550,7 +549,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { //process.BeginErrorReadLine(); - var result = _jsonSerializer.DeserializeFromStream(process.StandardOutput.BaseStream); + var result = await _jsonSerializer.DeserializeFromStreamAsync(process.StandardOutput.BaseStream).ConfigureAwait(false); if (result == null || (result.streams == null && result.format == null)) { diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index d0ccef2f8..5367a87f7 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -1,20 +1,17 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Xml; -using MediaBrowser.Model.IO; - -using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.MediaInfo; +using Microsoft.Extensions.Logging; namespace MediaBrowser.MediaEncoding.Probing { diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 8a9aae117..8eed5e626 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1,31 +1,29 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.LiveTv; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Providers; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Net; using MediaBrowser.Common.Progress; -using MediaBrowser.Model.IO; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dto; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Serialization; -using Priority_Queue; -using MediaBrowser.Model.Extensions; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Subtitles; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Providers; +using MediaBrowser.Model.Serialization; +using Microsoft.Extensions.Logging; +using Priority_Queue; namespace MediaBrowser.Providers.Manager { @@ -827,7 +825,7 @@ namespace MediaBrowser.Providers.Manager } } } - catch (Exception ex) + catch (Exception) { // Logged at lower levels } diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs index 123c0493f..ae8e638cb 100644 --- a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs +++ b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.XbmcMetadata.Savers; -using System.IO; +using System.IO; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.IO; +using MediaBrowser.XbmcMetadata.Savers; namespace MediaBrowser.XbmcMetadata.Providers { @@ -13,7 +13,7 @@ namespace MediaBrowser.XbmcMetadata.Providers { protected IFileSystem FileSystem; - public async Task> GetMetadata(ItemInfo info, + public Task> GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken) { @@ -23,7 +23,7 @@ namespace MediaBrowser.XbmcMetadata.Providers if (file == null) { - return result; + return Task.FromResult(result); } var path = file.FullName; @@ -44,7 +44,7 @@ namespace MediaBrowser.XbmcMetadata.Providers result.HasMetadata = false; } - return result; + return Task.FromResult(result); } protected abstract void Fetch(MetadataResult result, string path, CancellationToken cancellationToken);