update timer listings

pull/702/head
Luke Pulverenti 8 years ago
parent d3583c1460
commit c4e137e6cf

@ -315,6 +315,8 @@ namespace MediaBrowser.Api.LiveTv
public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
public bool? IsScheduled { get; set; }
}
[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
@ -1095,7 +1097,8 @@ namespace MediaBrowser.Api.LiveTv
{
ChannelId = request.ChannelId,
SeriesTimerId = request.SeriesTimerId,
IsActive = request.IsActive
IsActive = request.IsActive,
IsScheduled = request.IsScheduled
}, CancellationToken.None).ConfigureAwait(false);

@ -463,13 +463,15 @@ namespace MediaBrowser.Api.Playback
var level = NormalizeTranscodingLevel(state.OutputVideoCodec, state.VideoRequest.Level);
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
// also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoEncoder, "libx264", StringComparison.OrdinalIgnoreCase))
{
switch (level)
{
case "30":
param += " -level 3";
param += " -level 3.0";
break;
case "31":
param += " -level 3.1";
@ -478,7 +480,7 @@ namespace MediaBrowser.Api.Playback
param += " -level 3.2";
break;
case "40":
param += " -level 4";
param += " -level 4.0";
break;
case "41":
param += " -level 4.1";
@ -487,7 +489,7 @@ namespace MediaBrowser.Api.Playback
param += " -level 4.2";
break;
case "50":
param += " -level 5";
param += " -level 5.0";
break;
case "51":
param += " -level 5.1";

@ -106,6 +106,7 @@ namespace MediaBrowser.Controller.LiveTv
public string EpisodeTitle { get; set; }
public DateTime? OriginalAirDate { get; set; }
public bool IsProgramSeries { get; set; }
public bool IsRepeat { get; set; }
public string HomePageUrl { get; set; }
public float? CommunityRating { get; set; }
public string ShortOverview { get; set; }

@ -726,13 +726,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
levelString = NormalizeTranscodingLevel(state.OutputVideoCodec, levelString);
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
// also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoEncoder, "libx264", StringComparison.OrdinalIgnoreCase))
{
switch (levelString)
{
case "30":
param += " -level 3";
param += " -level 3.0";
break;
case "31":
param += " -level 3.1";
@ -741,7 +743,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
param += " -level 3.2";
break;
case "40":
param += " -level 4";
param += " -level 4.0";
break;
case "41":
param += " -level 4.1";
@ -750,7 +752,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
param += " -level 4.2";
break;
case "50":
param += " -level 5";
param += " -level 5.0";
break;
case "51":
param += " -level 5.1";

@ -1215,6 +1215,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
public RecordingStatus TimerStatus { get; set; }
/// <summary>
/// Gets or sets the current program.
/// </summary>

@ -15,5 +15,7 @@
public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
public bool? IsScheduled { get; set; }
}
}

@ -629,6 +629,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
existingTimer.IsNews = updatedTimer.IsNews;
existingTimer.IsMovie = updatedTimer.IsMovie;
existingTimer.IsProgramSeries = updatedTimer.IsProgramSeries;
existingTimer.IsRepeat = updatedTimer.IsRepeat;
existingTimer.IsSports = updatedTimer.IsSports;
existingTimer.Name = updatedTimer.Name;
existingTimer.OfficialRating = updatedTimer.OfficialRating;
@ -665,8 +666,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
var excludeStatues = new List<RecordingStatus>
{
RecordingStatus.Completed,
RecordingStatus.Cancelled
RecordingStatus.Completed
};
var timers = _timerProvider.GetAll()
@ -1591,6 +1591,29 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private bool ShouldCancelTimerForSeriesTimer(SeriesTimerInfo seriesTimer, TimerInfo timer)
{
if (!seriesTimer.RecordAnyTime)
{
if (Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - timer.StartDate.TimeOfDay.Ticks) >= TimeSpan.FromMinutes(5).Ticks)
{
return true;
}
if (!seriesTimer.Days.Contains(timer.StartDate.ToLocalTime().DayOfWeek))
{
return true;
}
}
if (seriesTimer.RecordNewOnly && timer.IsRepeat)
{
return true;
}
if (!seriesTimer.RecordAnyChannel && !string.Equals(timer.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase))
{
return true;
}
return seriesTimer.SkipEpisodesInLibrary && IsProgramAlreadyInLibrary(timer);
}
@ -1734,23 +1757,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private IEnumerable<ProgramInfo> GetProgramsForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms)
{
if (!seriesTimer.RecordAnyTime)
{
allPrograms = allPrograms.Where(epg => Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - epg.StartDate.TimeOfDay.Ticks) < TimeSpan.FromMinutes(5).Ticks);
allPrograms = allPrograms.Where(i => seriesTimer.Days.Contains(i.StartDate.ToLocalTime().DayOfWeek));
}
if (seriesTimer.RecordNewOnly)
{
allPrograms = allPrograms.Where(epg => !epg.IsRepeat);
}
if (!seriesTimer.RecordAnyChannel)
{
allPrograms = allPrograms.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase));
}
if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId))
{
_logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series");

@ -2,6 +2,7 @@
using MediaBrowser.Controller.LiveTv;
using System;
using System.Globalization;
using MediaBrowser.Model.LiveTv;
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
@ -12,24 +13,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
return timer.StartDate.AddSeconds(-timer.PrePaddingSeconds);
}
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo series)
public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo seriesTimer)
{
var timer = new TimerInfo();
timer.ChannelId = parent.ChannelId;
timer.Id = (series.Id + parent.Id).GetMD5().ToString("N");
timer.Id = (seriesTimer.Id + parent.Id).GetMD5().ToString("N");
timer.StartDate = parent.StartDate;
timer.EndDate = parent.EndDate;
timer.ProgramId = parent.Id;
timer.PrePaddingSeconds = series.PrePaddingSeconds;
timer.PostPaddingSeconds = series.PostPaddingSeconds;
timer.IsPostPaddingRequired = series.IsPostPaddingRequired;
timer.IsPrePaddingRequired = series.IsPrePaddingRequired;
timer.KeepUntil = series.KeepUntil;
timer.Priority = series.Priority;
timer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
timer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
timer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
timer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
timer.KeepUntil = seriesTimer.KeepUntil;
timer.Priority = seriesTimer.Priority;
timer.Name = parent.Name;
timer.Overview = parent.Overview;
timer.SeriesTimerId = series.Id;
timer.SeriesTimerId = seriesTimer.Id;
CopyProgramInfoToTimerInfo(parent, timer);
@ -53,6 +54,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
timerInfo.CommunityRating = programInfo.CommunityRating;
timerInfo.ShortOverview = programInfo.ShortOverview;
timerInfo.OfficialRating = programInfo.OfficialRating;
timerInfo.IsRepeat = programInfo.IsRepeat;
}
public static string GetRecordingName(TimerInfo info)

@ -72,6 +72,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.ProgramInfo = _dtoService.GetBaseItemDto(program, new DtoOptions());
dto.ProgramInfo.TimerId = dto.Id;
dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId;
}

@ -1087,6 +1087,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
program.TimerId = _tvDtoService.GetInternalTimerId(serviceName, timer.Id)
.ToString("N");
program.TimerStatus = timer.Status;
if (!string.IsNullOrEmpty(timer.SeriesTimerId))
{
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(serviceName, timer.SeriesTimerId)
@ -1875,6 +1877,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
}
if (query.IsScheduled.HasValue)
{
if (query.IsScheduled.Value)
{
timers = timers.Where(i => i.Item1.Status == RecordingStatus.New || i.Item1.Status == RecordingStatus.Scheduled);
}
else
{
timers = timers.Where(i => !(i.Item1.Status == RecordingStatus.New || i.Item1.Status == RecordingStatus.Scheduled));
}
}
if (!string.IsNullOrEmpty(query.ChannelId))
{
var guid = new Guid(query.ChannelId);

Loading…
Cancel
Save