diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-02 15:32:41 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-02 15:32:41 -0400 |
| commit | 858c37b8607ff0698a94b9e7bfff6190d3bca56d (patch) | |
| tree | ec673c5ebe7ffe813b6a16340471ac472a5dbf5b /MediaBrowser.Server.Implementations/LiveTv | |
| parent | 36648d27082c1ee50c1483e17f14ba1ae838a00e (diff) | |
add channel downloading settings
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 0d0707386b..df48e952f8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -297,6 +297,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv var result = await service.GetRecordingStream(recording.Id, cancellationToken).ConfigureAwait(false); + Sanitize(result); + _logger.Debug("Live stream info: " + _json.SerializeToString(result)); if (!string.IsNullOrEmpty(result.Id)) @@ -332,6 +334,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv var result = await service.GetChannelStream(channel.ExternalId, cancellationToken).ConfigureAwait(false); + Sanitize(result); + _logger.Debug("Live stream info: " + _json.SerializeToString(result)); if (!string.IsNullOrEmpty(result.Id)) @@ -353,6 +357,55 @@ namespace MediaBrowser.Server.Implementations.LiveTv } } + private void Sanitize(LiveStreamInfo info) + { + // Clean some bad data coming from providers + + foreach (var stream in info.MediaStreams) + { + if (stream.BitDepth.HasValue && stream.BitDepth <= 0) + { + stream.BitDepth = null; + } + if (stream.BitRate.HasValue && stream.BitRate <= 0) + { + stream.BitRate = null; + } + if (stream.Channels.HasValue && stream.Channels <= 0) + { + stream.Channels = null; + } + if (stream.AverageFrameRate.HasValue && stream.AverageFrameRate <= 0) + { + stream.AverageFrameRate = null; + } + if (stream.RealFrameRate.HasValue && stream.RealFrameRate <= 0) + { + stream.RealFrameRate = null; + } + if (stream.Width.HasValue && stream.Width <= 0) + { + stream.Width = null; + } + if (stream.Height.HasValue && stream.Height <= 0) + { + stream.Height = null; + } + if (stream.SampleRate.HasValue && stream.SampleRate <= 0) + { + stream.SampleRate = null; + } + if (stream.Level.HasValue && stream.Level <= 0) + { + stream.Level = null; + } + if (stream.PacketLength.HasValue && stream.PacketLength <= 0) + { + stream.PacketLength = null; + } + } + } + private async Task<LiveTvChannel> GetChannel(ChannelInfo channelInfo, string serviceName, CancellationToken cancellationToken) { var path = Path.Combine(_config.ApplicationPaths.ItemsByNamePath, "tvchannels", _fileSystem.GetValidFilename(channelInfo.Name)); |
