improve display of active recordings

This commit is contained in:
Luke Pulverenti 2016-06-19 13:41:49 -04:00
parent 7627c6707d
commit f58a919488
4 changed files with 21 additions and 1 deletions

View File

@ -200,6 +200,8 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by timers belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
}
[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
@ -927,7 +929,8 @@ namespace MediaBrowser.Api.LiveTv
var result = await _liveTvManager.GetTimers(new TimerQuery
{
ChannelId = request.ChannelId,
SeriesTimerId = request.SeriesTimerId
SeriesTimerId = request.SeriesTimerId,
IsActive = request.IsActive
}, CancellationToken.None).ConfigureAwait(false);

View File

@ -13,5 +13,7 @@
/// </summary>
/// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
}
}

View File

@ -1010,6 +1010,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
Action onStarted = () =>
{
timer.Status = RecordingStatus.InProgress;
_timerProvider.AddOrUpdate(timer);
result.Item3.Release();
isResourceOpen = false;
};

View File

@ -1665,6 +1665,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
var timers = results.SelectMany(i => i.ToList());
if (query.IsActive.HasValue)
{
if (query.IsActive.Value)
{
timers = timers.Where(i => i.Item1.Status == RecordingStatus.InProgress);
}
else
{
timers = timers.Where(i => i.Item1.Status != RecordingStatus.InProgress);
}
}
if (!string.IsNullOrEmpty(query.ChannelId))
{
var guid = new Guid(query.ChannelId);