public async Task <TimerInfo> GetTimerInfo(TimerInfoDto dto, bool isNew, ILiveTvManager liveTv, CancellationToken cancellationToken) { var info = new TimerInfo { Overview = dto.Overview, EndDate = dto.EndDate, Name = dto.Name, StartDate = dto.StartDate, Status = dto.Status, PrePaddingSeconds = dto.PrePaddingSeconds, PostPaddingSeconds = dto.PostPaddingSeconds, IsPostPaddingRequired = dto.IsPostPaddingRequired, IsPrePaddingRequired = dto.IsPrePaddingRequired, Priority = dto.Priority, SeriesTimerId = dto.ExternalSeriesTimerId, ProgramId = dto.ExternalProgramId, ChannelId = dto.ExternalChannelId, Id = dto.ExternalId }; // Convert internal server id's to external tv provider id's if (!isNew && !string.IsNullOrEmpty(dto.Id) && string.IsNullOrEmpty(info.Id)) { var timer = await liveTv.GetSeriesTimer(dto.Id, cancellationToken).ConfigureAwait(false); info.Id = timer.ExternalId; } if (!string.IsNullOrEmpty(dto.ChannelId) && string.IsNullOrEmpty(info.ChannelId)) { var channel = await liveTv.GetChannel(dto.ChannelId, cancellationToken).ConfigureAwait(false); if (channel != null) { info.ChannelId = channel.ExternalId; } } if (!string.IsNullOrEmpty(dto.ProgramId) && string.IsNullOrEmpty(info.ProgramId)) { var program = await liveTv.GetProgram(dto.ProgramId, cancellationToken).ConfigureAwait(false); if (program != null) { info.ProgramId = program.ExternalId; } } if (!string.IsNullOrEmpty(dto.SeriesTimerId) && string.IsNullOrEmpty(info.SeriesTimerId)) { var timer = await liveTv.GetSeriesTimer(dto.SeriesTimerId, cancellationToken).ConfigureAwait(false); if (timer != null) { info.SeriesTimerId = timer.ExternalId; } } return(info); }
public async Task <TimerInfo> GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken) { var info = new TimerInfo { Overview = dto.Overview, EndDate = dto.EndDate, Name = dto.Name, StartDate = dto.StartDate, Status = dto.Status, PrePaddingSeconds = dto.PrePaddingSeconds, PostPaddingSeconds = dto.PostPaddingSeconds, IsPostPaddingRequired = dto.IsPostPaddingRequired, IsPrePaddingRequired = dto.IsPrePaddingRequired, KeepUntil = dto.KeepUntil, Priority = dto.Priority, SeriesTimerId = dto.ExternalSeriesTimerId, ProgramId = dto.ExternalProgramId, ChannelId = dto.ExternalChannelId, Id = dto.ExternalId }; // Convert internal server id's to external tv provider id's if (!isNew && !string.IsNullOrEmpty(dto.Id) && string.IsNullOrEmpty(info.Id)) { var timer = await liveTv.GetSeriesTimer(dto.Id, cancellationToken).ConfigureAwait(false); info.Id = timer.ExternalId; } if (!dto.ChannelId.Equals(default) && string.IsNullOrEmpty(info.ChannelId))
public TimerInfoDto GetTimerInfoDto(TimerInfo info, ILiveTvService service, LiveTvProgram program, LiveTvChannel channel) { var dto = new TimerInfoDto { Id = GetInternalTimerId(service.Name, info.Id).ToString("N"), Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"), Status = info.Status, SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), PrePaddingSeconds = info.PrePaddingSeconds, PostPaddingSeconds = info.PostPaddingSeconds, IsPostPaddingRequired = info.IsPostPaddingRequired, IsPrePaddingRequired = info.IsPrePaddingRequired, KeepUntil = info.KeepUntil, ExternalChannelId = info.ChannelId, ExternalSeriesTimerId = info.SeriesTimerId, ServiceName = service.Name, ExternalProgramId = info.ProgramId, Priority = info.Priority, RunTimeTicks = (info.EndDate - info.StartDate).Ticks, ServerId = _appHost.SystemId }; if (!string.IsNullOrEmpty(info.ProgramId)) { dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); } if (program != null) { dto.ProgramInfo = _dtoService.GetBaseItemDto(program, new DtoOptions()); if (info.Status != RecordingStatus.Cancelled && info.Status != RecordingStatus.Error) { dto.ProgramInfo.TimerId = dto.Id; dto.ProgramInfo.Status = info.Status.ToString(); } dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; if (!string.IsNullOrWhiteSpace(info.SeriesTimerId)) { FillImages(dto.ProgramInfo, info.Name, info.SeriesId); } } if (channel != null) { dto.ChannelName = channel.Name; } return(dto); }
public override void WireMessages() { Messenger.Default.Register <NotificationMessage>(this, m => { if (m.Notification.Equals(Constants.Messages.ScheduledRecordingChangedMsg)) { SelectedRecording = (TimerInfoDto)m.Sender; //ServerIdItem = SelectedRecording; } }); }
public TimerInfoDto GetTimerInfoDto(TimerInfo info, ILiveTvService service, LiveTvProgram program, LiveTvChannel channel) { var dto = new TimerInfoDto { Id = GetInternalTimerId(service.Name, info.Id).ToString("N"), Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"), Status = info.Status, SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), PrePaddingSeconds = info.PrePaddingSeconds, PostPaddingSeconds = info.PostPaddingSeconds, IsPostPaddingRequired = info.IsPostPaddingRequired, IsPrePaddingRequired = info.IsPrePaddingRequired, ExternalChannelId = info.ChannelId, ExternalSeriesTimerId = info.SeriesTimerId, ServiceName = service.Name, ExternalProgramId = info.ProgramId, Priority = info.Priority, RunTimeTicks = (info.EndDate - info.StartDate).Ticks, ServerId = _appHost.SystemId }; if (!string.IsNullOrEmpty(info.ProgramId)) { dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); } if (program != null) { dto.ProgramInfo = GetProgramInfoDto(program, channel); dto.ProgramInfo.TimerId = dto.Id; dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; } if (channel != null) { dto.ChannelName = channel.Name; } return(dto); }
public static async Task <bool> CancelRecording(TimerInfoDto item, INavigationService navigationService, IApiClient apiClient, ILog log, bool goBack = false) { return(await CancelRecording(item.Id, navigationService, apiClient, log, goBack)); }