diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-15 09:19:24 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-15 09:19:24 -0500 |
| commit | 98d53c7838f8495ccf0f908879527f1e127c2b36 (patch) | |
| tree | 417c8e65a1a497ac9242a325c80baba93b8855ca /MediaBrowser.Server.Implementations | |
| parent | 01e65c93eeeddff27fc2e0e4833678c5cc2829a0 (diff) | |
live tv + nuget updates
Diffstat (limited to 'MediaBrowser.Server.Implementations')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 37 |
2 files changed, 29 insertions, 23 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index f93821cc9..fc030dbf8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -46,7 +46,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds, RequiredPrePaddingSeconds = info.RequiredPrePaddingSeconds, ExternalChannelId = info.ChannelId, - ExternalSeriesTimerId = info.SeriesTimerId + ExternalSeriesTimerId = info.SeriesTimerId, + ServiceName = service.Name }; var duration = info.EndDate - info.StartDate; @@ -71,7 +72,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, - ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), RequestedPostPaddingSeconds = info.RequestedPostPaddingSeconds, RequestedPrePaddingSeconds = info.RequestedPrePaddingSeconds, RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds, @@ -80,9 +80,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv Priority = info.Priority, RecurrenceType = info.RecurrenceType, ExternalChannelId = info.ChannelId, - ExternalProgramId = info.ProgramId + ExternalProgramId = info.ProgramId, + ServiceName = service.Name }; + if (!string.IsNullOrEmpty(info.ChannelId)) + { + dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"); + } + if (!string.IsNullOrEmpty(info.ProgramId)) { dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); @@ -139,7 +145,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv CommunityRating = info.CommunityRating, OfficialRating = info.OfficialRating, Audio = info.Audio, - IsHD = info.IsHD + IsHD = info.IsHD, + ServiceName = service.Name }; if (user != null) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 318f450f1..37794cb3d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -348,22 +348,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv public async Task DeleteRecording(string recordingId) { - var recordings = await GetRecordings(new RecordingQuery - { - - }, CancellationToken.None).ConfigureAwait(false); - - var recording = recordings.Items - .FirstOrDefault(i => string.Equals(recordingId, i.Id, StringComparison.OrdinalIgnoreCase)); + var recording = await GetRecording(recordingId, CancellationToken.None).ConfigureAwait(false); if (recording == null) { throw new ResourceNotFoundException(string.Format("Recording with Id {0} not found", recordingId)); } - var channel = GetChannel(recording.ChannelId); - - var service = GetServices(channel.ServiceName, null) + var service = GetServices(recording.ServiceName, null) .First(); await service.DeleteRecordingAsync(recording.ExternalId, CancellationToken.None).ConfigureAwait(false); @@ -371,25 +363,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv public async Task CancelTimer(string id) { - var timers = await GetTimers(new TimerQuery + var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false); + + if (timer == null) { + throw new ResourceNotFoundException(string.Format("Timer with Id {0} not found", id)); + } - }, CancellationToken.None).ConfigureAwait(false); + var service = GetServices(timer.ServiceName, null) + .First(); + + await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); + } - var timer = timers.Items - .FirstOrDefault(i => string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase)); + public async Task CancelSeriesTimer(string id) + { + var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false); if (timer == null) { throw new ResourceNotFoundException(string.Format("Timer with Id {0} not found", id)); } - var channel = GetChannel(timer.ChannelId); - - var service = GetServices(channel.ServiceName, null) + var service = GetServices(timer.ServiceName, null) .First(); - await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); + await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); } public async Task<RecordingInfoDto> GetRecording(string id, CancellationToken cancellationToken, User user = null) @@ -416,7 +415,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv return results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.CurrentCulture)); } - + public Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken) { var info = _tvDtoService.GetTimerInfo(timer); |
