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

@ -463,13 +463,15 @@ namespace MediaBrowser.Api.Playback
var level = NormalizeTranscodingLevel(state.OutputVideoCodec, state.VideoRequest.Level); 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 // 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) || 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) switch (level)
{ {
case "30": case "30":
param += " -level 3"; param += " -level 3.0";
break; break;
case "31": case "31":
param += " -level 3.1"; param += " -level 3.1";
@ -478,7 +480,7 @@ namespace MediaBrowser.Api.Playback
param += " -level 3.2"; param += " -level 3.2";
break; break;
case "40": case "40":
param += " -level 4"; param += " -level 4.0";
break; break;
case "41": case "41":
param += " -level 4.1"; param += " -level 4.1";
@ -487,7 +489,7 @@ namespace MediaBrowser.Api.Playback
param += " -level 4.2"; param += " -level 4.2";
break; break;
case "50": case "50":
param += " -level 5"; param += " -level 5.0";
break; break;
case "51": case "51":
param += " -level 5.1"; param += " -level 5.1";

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

@ -726,13 +726,15 @@ namespace MediaBrowser.MediaEncoding.Encoder
levelString = NormalizeTranscodingLevel(state.OutputVideoCodec, levelString); 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 // 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) || 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) switch (levelString)
{ {
case "30": case "30":
param += " -level 3"; param += " -level 3.0";
break; break;
case "31": case "31":
param += " -level 3.1"; param += " -level 3.1";
@ -741,7 +743,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
param += " -level 3.2"; param += " -level 3.2";
break; break;
case "40": case "40":
param += " -level 4"; param += " -level 4.0";
break; break;
case "41": case "41":
param += " -level 4.1"; param += " -level 4.1";
@ -750,7 +752,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
param += " -level 4.2"; param += " -level 4.2";
break; break;
case "50": case "50":
param += " -level 5"; param += " -level 5.0";
break; break;
case "51": case "51":
param += " -level 5.1"; param += " -level 5.1";

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

@ -15,5 +15,7 @@
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
public bool? IsActive { 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.IsNews = updatedTimer.IsNews;
existingTimer.IsMovie = updatedTimer.IsMovie; existingTimer.IsMovie = updatedTimer.IsMovie;
existingTimer.IsProgramSeries = updatedTimer.IsProgramSeries; existingTimer.IsProgramSeries = updatedTimer.IsProgramSeries;
existingTimer.IsRepeat = updatedTimer.IsRepeat;
existingTimer.IsSports = updatedTimer.IsSports; existingTimer.IsSports = updatedTimer.IsSports;
existingTimer.Name = updatedTimer.Name; existingTimer.Name = updatedTimer.Name;
existingTimer.OfficialRating = updatedTimer.OfficialRating; existingTimer.OfficialRating = updatedTimer.OfficialRating;
@ -665,8 +666,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
var excludeStatues = new List<RecordingStatus> var excludeStatues = new List<RecordingStatus>
{ {
RecordingStatus.Completed, RecordingStatus.Completed
RecordingStatus.Cancelled
}; };
var timers = _timerProvider.GetAll() var timers = _timerProvider.GetAll()
@ -1591,6 +1591,29 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private bool ShouldCancelTimerForSeriesTimer(SeriesTimerInfo seriesTimer, TimerInfo timer) 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); return seriesTimer.SkipEpisodesInLibrary && IsProgramAlreadyInLibrary(timer);
} }
@ -1734,23 +1757,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private IEnumerable<ProgramInfo> GetProgramsForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms) 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)) if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId))
{ {
_logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series"); _logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series");

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

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

@ -1087,6 +1087,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
program.TimerId = _tvDtoService.GetInternalTimerId(serviceName, timer.Id) program.TimerId = _tvDtoService.GetInternalTimerId(serviceName, timer.Id)
.ToString("N"); .ToString("N");
program.TimerStatus = timer.Status;
if (!string.IsNullOrEmpty(timer.SeriesTimerId)) if (!string.IsNullOrEmpty(timer.SeriesTimerId))
{ {
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(serviceName, 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)) if (!string.IsNullOrEmpty(query.ChannelId))
{ {
var guid = new Guid(query.ChannelId); var guid = new Guid(query.ChannelId);

Loading…
Cancel
Save