aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-11-05 16:51:23 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-11-05 16:51:23 -0500
commit5cb74690284105db70a467ab77c2af3f44e42348 (patch)
tree0e37b05d34dbcbe3d08d0c74229287cd0cd6f496 /Emby.Server.Implementations/LiveTv
parentb9c1f61681de23d95de7c6b392eb3e55670991da (diff)
support track selection before playback
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs22
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs5
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs5
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs11
5 files changed, 30 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index be5e57539b..b469966f5c 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -2445,6 +2445,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
existingTimer.Status = RecordingStatus.Cancelled;
}
+ else if (!existingTimer.IsManual)
+ {
+ existingTimer.Status = RecordingStatus.New;
+ }
if (existingTimer.Status != RecordingStatus.Cancelled)
{
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 718620ab57..7e72d1b1a1 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1232,6 +1232,8 @@ namespace Emby.Server.Implementations.LiveTv
var newChannelIdList = new List<Guid>();
var newProgramIdList = new List<Guid>();
+ var cleanDatabase = true;
+
foreach (var service in _services)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -1254,6 +1256,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ cleanDatabase = false;
_logger.ErrorException("Error refreshing channels for service", ex);
}
@@ -1264,8 +1267,11 @@ namespace Emby.Server.Implementations.LiveTv
progress.Report(100 * percent);
}
- await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
- await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
+ if (cleanDatabase)
+ {
+ await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
+ await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
+ }
var coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault();
@@ -1291,8 +1297,9 @@ namespace Emby.Server.Implementations.LiveTv
{
progress.Report(10);
- var allChannels = await GetChannels(service, cancellationToken).ConfigureAwait(false);
- var allChannelsList = allChannels.ToList();
+ var allChannelsList = (await service.GetChannelsAsync(cancellationToken).ConfigureAwait(false))
+ .Select(i => new Tuple<string, ChannelInfo>(service.Name, i))
+ .ToList();
var list = new List<LiveTvChannel>();
@@ -1507,13 +1514,6 @@ namespace Emby.Server.Implementations.LiveTv
return 7;
}
- private async Task<IEnumerable<Tuple<string, ChannelInfo>>> GetChannels(ILiveTvService service, CancellationToken cancellationToken)
- {
- var channels = await service.GetChannelsAsync(cancellationToken).ConfigureAwait(false);
-
- return channels.Select(i => new Tuple<string, ChannelInfo>(service.Name, i));
- }
-
private DateTime _lastRecordingRefreshTime;
private async Task RefreshRecordings(Guid internalLiveTvFolderId, CancellationToken cancellationToken)
{
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
index 7e0e5fc5c9..1ea77d505e 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHttpStream.cs
@@ -73,9 +73,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
//OpenedMediaSource.SupportsTranscoding = true;
}
- public override void Close()
+ protected override void CloseInternal()
{
- Logger.Info("Closing HDHR live stream");
LiveStreamCancellationTokenSource.Cancel();
}
@@ -106,7 +105,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
Logger.ErrorException("Error copying live stream.", ex);
}
-
+ EnableStreamSharing = false;
await DeleteTempFile(TempFilePath).ConfigureAwait(false);
});
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
index 06326d26c6..8b46b78be9 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
@@ -105,9 +105,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
await taskCompletionSource.Task.ConfigureAwait(false);
}
- public override void Close()
+ protected override void CloseInternal()
{
- Logger.Info("Closing HDHR UDP live stream");
LiveStreamCancellationTokenSource.Cancel();
}
@@ -134,6 +133,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
openTaskCompletionSource.TrySetException(ex);
}
+ EnableStreamSharing = false;
+
try
{
await hdHomerunManager.StopStreaming().ConfigureAwait(false);
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
index 8620987355..cead1def03 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
@@ -52,7 +52,16 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return Task.FromResult(true);
}
- public virtual void Close()
+ public void Close()
+ {
+ EnableStreamSharing = false;
+
+ Logger.Info("Closing " + GetType().Name);
+
+ CloseInternal();
+ }
+
+ protected virtual void CloseInternal()
{
}