aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-01-26 01:26:58 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-01-26 01:26:58 -0500
commit045fdaf3874c9b57d80a97d0fefdcd3454f7c044 (patch)
tree0a818e5d227360b38e5ef3e8ef64189ead427630
parent8f780269cbf8b9b1000f83432262e93c487164eb (diff)
update live stream bitrates
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs5
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/TimerInfo.cs1
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs6
-rw-r--r--MediaBrowser.Model/Dto/MediaSourceInfo.cs9
-rw-r--r--MediaBrowser.Providers/TV/TvExternalIds.cs24
-rw-r--r--MediaBrowser.Server.Startup.Common/LiveTv/TunerHosts/SatIp/SatIpHost.cs2
-rw-r--r--MediaBrowser.Tests/M3uParserTest.cs24
8 files changed, 37 insertions, 36 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index f792d8b65..5e0b4ff34 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1064,8 +1064,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var isAudio = false;
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);
- stream.InferTotalBitrate();
-
return new List<MediaSourceInfo>
{
stream
@@ -1372,13 +1370,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
ActiveRecordingInfo removed;
_activeRecordings.TryRemove(timer.Id, out removed);
- if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate)
+ if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate && timer.RetryCount < 10)
{
const int retryIntervalSeconds = 60;
_logger.Info("Retrying recording in {0} seconds.", retryIntervalSeconds);
timer.Status = RecordingStatus.New;
timer.StartDate = DateTime.UtcNow.AddSeconds(retryIntervalSeconds);
+ timer.RetryCount++;
_timerProvider.AddOrUpdate(timer);
}
else if (_fileSystem.FileExists(recordPath))
diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
index 78390f084..0313e6fde 100644
--- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
@@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.LiveTv
}
// Try to estimate this
- mediaSource.InferTotalBitrate();
+ mediaSource.InferTotalBitrate(true);
}
}
}
diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
index 10ed95fe5..3c935f924 100644
--- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
@@ -94,6 +94,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The priority.</value>
public int Priority { get; set; }
+ public int RetryCount { get; set; }
// Program properties
public int? SeasonNumber { get; set; }
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 0273f2753..2f8ecaece 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -187,11 +187,7 @@ namespace MediaBrowser.MediaEncoding.Probing
// If ffprobe reported the container bitrate as being the same as the video stream bitrate, then it's wrong
if (videoStreamsBitrate == (info.Bitrate ?? 0))
{
- var streamBitrates = info.MediaStreams.Where(i => !i.IsExternal).Select(i => i.BitRate ?? 0).Sum();
- if (streamBitrates > (info.Bitrate ?? 0))
- {
- info.Bitrate = streamBitrates;
- }
+ info.InferTotalBitrate(true);
}
}
diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
index 250cbeb10..d20911a7f 100644
--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs
+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
@@ -72,9 +72,14 @@ namespace MediaBrowser.Model.Dto
SupportsProbing = true;
}
- public void InferTotalBitrate()
+ public void InferTotalBitrate(bool force = false)
{
- if (Bitrate.HasValue || MediaStreams == null)
+ if (MediaStreams == null)
+ {
+ return;
+ }
+
+ if (!force && Bitrate.HasValue)
{
return;
}
diff --git a/MediaBrowser.Providers/TV/TvExternalIds.cs b/MediaBrowser.Providers/TV/TvExternalIds.cs
index 2ba3b6ff6..d2860a622 100644
--- a/MediaBrowser.Providers/TV/TvExternalIds.cs
+++ b/MediaBrowser.Providers/TV/TvExternalIds.cs
@@ -119,28 +119,4 @@ namespace MediaBrowser.Providers.TV
return item is Series;
}
}
-
- public class TvComPersonExternalId : IExternalId
- {
- public string Name
- {
- get { return "TV.com"; }
- }
-
- public string Key
- {
- get { return MetadataProviders.Tvcom.ToString(); }
- }
-
- public string UrlFormatString
- {
- get { return null; }
- }
-
- public bool Supports(IHasProviderIds item)
- {
- return item is Person;
- }
- }
-
}
diff --git a/MediaBrowser.Server.Startup.Common/LiveTv/TunerHosts/SatIp/SatIpHost.cs b/MediaBrowser.Server.Startup.Common/LiveTv/TunerHosts/SatIp/SatIpHost.cs
index ac83440f2..fffca4ca9 100644
--- a/MediaBrowser.Server.Startup.Common/LiveTv/TunerHosts/SatIp/SatIpHost.cs
+++ b/MediaBrowser.Server.Startup.Common/LiveTv/TunerHosts/SatIp/SatIpHost.cs
@@ -115,7 +115,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
RequiresClosing = false
};
- mediaSource.InferTotalBitrate();
+ mediaSource.InferTotalBitrate(true);
return new List<MediaSourceInfo> { mediaSource };
}
diff --git a/MediaBrowser.Tests/M3uParserTest.cs b/MediaBrowser.Tests/M3uParserTest.cs
index 3285d0740..3320d8794 100644
--- a/MediaBrowser.Tests/M3uParserTest.cs
+++ b/MediaBrowser.Tests/M3uParserTest.cs
@@ -64,5 +64,29 @@ namespace MediaBrowser.Tests
Assert.IsNull(result[0].Number);
Assert.AreEqual("ABC KABC Los Angeles", result[0].Name);
}
+
+ [TestMethod]
+ public void TestFormat5()
+ {
+ BaseExtensions.CryptographyProvider = new CryptographyProvider();
+
+ var result = new M3uParser(new NullLogger(), null, null, null).ParseString("#EXTINF:-1 channel-id=\"2101\" tvg-id=\"I69387.json.schedulesdirect.org\" group-title=\"Entertainment\",BBC 1 HD\nhttp://mystream", "-", "-");
+ Assert.AreEqual(1, result.Count);
+
+ Assert.AreEqual("BBC 1 HD", result[0].Name);
+ Assert.AreEqual("2101", result[0].Number);
+ }
+
+ [TestMethod]
+ public void TestFormat6()
+ {
+ BaseExtensions.CryptographyProvider = new CryptographyProvider();
+
+ var result = new M3uParser(new NullLogger(), null, null, null).ParseString("#EXTINF:-1 tvg-id=\"2101\" group-title=\"Entertainment\",BBC 1 HD\nhttp://mystream", "-", "-");
+ Assert.AreEqual(1, result.Count);
+
+ Assert.AreEqual("BBC 1 HD", result[0].Name);
+ Assert.AreEqual("2101", result[0].Number);
+ }
}
}