diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index 423fe7b183..e28acd769f 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 4275799a98..22ed788e0c 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 e4c417c8a9..3d006a699c 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 7333149c2b..befbb21404 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 e97898ac53..9761de98fb 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 d2cf7f3950..c62de0b113 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 a661d76917..181fc0f655 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 d0ccef2f80..5367a87f7b 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 8a9aae1175..8eed5e6266 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1,31 +1,29 @@ -using MediaBrowser.Common.Net; +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.Controller; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Dto; 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.Controller.Subtitles; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Providers; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Common.Progress; -using MediaBrowser.Model.IO; -using MediaBrowser.Controller.Dto; using MediaBrowser.Model.Events; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; +using Microsoft.Extensions.Logging; using Priority_Queue; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Controller.Subtitles; 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 123c0493fb..ae8e638cbd 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);