Merge pull request #2421 from MediaBrowser/dev

Dev
pull/1154/head
Luke 8 years ago committed by GitHub
commit 6f93e605cf

@ -2593,7 +2593,7 @@ namespace Emby.Server.Implementations.Library
{ {
foreach (var pathInfo in libraryOptions.PathInfos) foreach (var pathInfo in libraryOptions.PathInfos)
{ {
if (string.IsNullOrWhiteSpace(pathInfo.NetworkPath)) if (string.IsNullOrWhiteSpace(pathInfo.Path) || string.IsNullOrWhiteSpace(pathInfo.NetworkPath))
{ {
continue; continue;
} }
@ -2620,6 +2620,8 @@ namespace Emby.Server.Implementations.Library
} }
foreach (var map in ConfigurationManager.Configuration.PathSubstitutions) foreach (var map in ConfigurationManager.Configuration.PathSubstitutions)
{
if (!string.IsNullOrWhiteSpace(map.From))
{ {
var substitutionResult = SubstitutePathInternal(path, map.From, map.To); var substitutionResult = SubstitutePathInternal(path, map.From, map.To);
if (substitutionResult.Item2) if (substitutionResult.Item2)
@ -2627,6 +2629,7 @@ namespace Emby.Server.Implementations.Library
return substitutionResult.Item1; return substitutionResult.Item1;
} }
} }
}
return path; return path;
} }

@ -1064,8 +1064,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var isAudio = false; var isAudio = false;
await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false); await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);
stream.InferTotalBitrate();
return new List<MediaSourceInfo> return new List<MediaSourceInfo>
{ {
stream stream
@ -1372,13 +1370,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
ActiveRecordingInfo removed; ActiveRecordingInfo removed;
_activeRecordings.TryRemove(timer.Id, out 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; const int retryIntervalSeconds = 60;
_logger.Info("Retrying recording in {0} seconds.", retryIntervalSeconds); _logger.Info("Retrying recording in {0} seconds.", retryIntervalSeconds);
timer.Status = RecordingStatus.New; timer.Status = RecordingStatus.New;
timer.StartDate = DateTime.UtcNow.AddSeconds(retryIntervalSeconds); timer.StartDate = DateTime.UtcNow.AddSeconds(retryIntervalSeconds);
timer.RetryCount++;
_timerProvider.AddOrUpdate(timer); _timerProvider.AddOrUpdate(timer);
} }
else if (_fileSystem.FileExists(recordPath)) else if (_fileSystem.FileExists(recordPath))

@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.LiveTv
} }
// Try to estimate this // Try to estimate this
mediaSource.InferTotalBitrate(); mediaSource.InferTotalBitrate(true);
} }
} }
} }

@ -94,6 +94,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The priority.</value> /// <value>The priority.</value>
public int Priority { get; set; } public int Priority { get; set; }
public int RetryCount { get; set; }
// Program properties // Program properties
public int? SeasonNumber { get; set; } public int? SeasonNumber { get; set; }

@ -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 ffprobe reported the container bitrate as being the same as the video stream bitrate, then it's wrong
if (videoStreamsBitrate == (info.Bitrate ?? 0)) if (videoStreamsBitrate == (info.Bitrate ?? 0))
{ {
var streamBitrates = info.MediaStreams.Where(i => !i.IsExternal).Select(i => i.BitRate ?? 0).Sum(); info.InferTotalBitrate(true);
if (streamBitrates > (info.Bitrate ?? 0))
{
info.Bitrate = streamBitrates;
}
} }
} }

@ -72,9 +72,14 @@ namespace MediaBrowser.Model.Dto
SupportsProbing = true; 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; return;
} }

@ -119,28 +119,4 @@ namespace MediaBrowser.Providers.TV
return item is Series; 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;
}
}
} }

@ -115,7 +115,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
RequiresClosing = false RequiresClosing = false
}; };
mediaSource.InferTotalBitrate(); mediaSource.InferTotalBitrate(true);
return new List<MediaSourceInfo> { mediaSource }; return new List<MediaSourceInfo> { mediaSource };
} }

@ -64,5 +64,29 @@ namespace MediaBrowser.Tests
Assert.IsNull(result[0].Number); Assert.IsNull(result[0].Number);
Assert.AreEqual("ABC KABC Los Angeles", result[0].Name); 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);
}
} }
} }

Loading…
Cancel
Save