Remove some warnings

This commit is contained in:
Bond_009 2018-12-31 00:28:23 +01:00 committed by Vasily
parent cf7e365610
commit c99b45dbe0
10 changed files with 71 additions and 99 deletions

View File

@ -136,19 +136,15 @@ namespace Emby.Common.Implementations.Serialization
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
}
public async Task<T> DeserializeFromStreamAsync<T>(Stream stream)
public Task<T> DeserializeFromStreamAsync<T>(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<T>(json);
}
return ServiceStack.Text.JsonSerializer.DeserializeFromStreamAsync<T>(stream);
}
/// <summary>

View File

@ -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<RootObject[]>(stream);
var obj = await _jsonSerializer.DeserializeFromStreamAsync<RootObject[]>(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<RootObject[]>(stream);
var obj = await _jsonSerializer.DeserializeFromStreamAsync<RootObject[]>(stream).ConfigureAwait(false);
obj = obj.Where(i => (i.assets ?? new List<Asset>()).Any(a => IsAsset(a, assetFilename, i.tag_name))).ToArray();
obj = obj.Where(i => (i.assets ?? new List<Asset>()).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;
}
}

View File

@ -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
{

View File

@ -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; }
/// <summary>

View File

@ -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)
});
}*/
}
}
}

View File

@ -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
{

View File

@ -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<InternalMediaInfoResult>(process.StandardOutput.BaseStream);
var result = await _jsonSerializer.DeserializeFromStreamAsync<InternalMediaInfoResult>(process.StandardOutput.BaseStream).ConfigureAwait(false);
if (result == null || (result.streams == null && result.format == null))
{

View File

@ -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
{

View File

@ -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
}

View File

@ -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<MetadataResult<T>> GetMetadata(ItemInfo info,
public Task<MetadataResult<T>> 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<T> result, string path, CancellationToken cancellationToken);