diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-18 00:44:46 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-18 00:44:46 -0500 |
| commit | e1e5d354345008e8d4ddc2dbbb99a68df4133280 (patch) | |
| tree | 3d7fff49a735cda9062e64f374dc7bf4e1df8108 /MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | |
| parent | 0b53ab76ebb26e2f93cdce4bb68dcdb4cf67d08d (diff) | |
live tv updates
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index b9dfc1b48..06ed4e200 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -459,11 +459,41 @@ namespace MediaBrowser.Server.Implementations.LiveTv return results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.CurrentCulture)); } - public async Task<TimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken) + public async Task<SeriesTimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken) { var info = await ActiveService.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); - return _tvDtoService.GetTimerInfoDto(info, ActiveService); + var obj = _tvDtoService.GetSeriesTimerInfoDto(info, ActiveService); + + obj.Id = obj.ExternalId = string.Empty; + + return obj; + } + + public async Task<SeriesTimerInfoDto> GetNewTimerDefaults(string programId, CancellationToken cancellationToken) + { + var info = await GetNewTimerDefaults(cancellationToken).ConfigureAwait(false); + + var program = await GetProgram(programId, cancellationToken).ConfigureAwait(false); + + info.Days = new List<DayOfWeek> + { + program.StartDate.ToLocalTime().DayOfWeek + }; + + info.DayPattern = _tvDtoService.GetDayPattern(info.Days); + + info.Name = program.Name; + info.ChannelId = program.ChannelId; + info.ChannelName = program.ChannelName; + info.EndDate = program.EndDate; + info.StartDate = program.StartDate; + info.Name = program.Name; + info.Overview = program.Overview; + info.ProgramId = program.Id; + info.ExternalProgramId = program.ExternalId; + + return info; } public async Task CreateTimer(TimerInfoDto timer, CancellationToken cancellationToken) @@ -472,6 +502,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv var info = await _tvDtoService.GetTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false); + // Set priority from default values + var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); + info.Priority = defaultValues.Priority; + await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false); } @@ -481,6 +515,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv var info = await _tvDtoService.GetSeriesTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false); + // Set priority from default values + var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); + info.Priority = defaultValues.Priority; + await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false); } |
