live tv + nuget updates

This commit is contained in:
Luke Pulverenti
2013-12-15 09:19:24 -05:00
parent 01e65c93ee
commit 98d53c7838
11 changed files with 98 additions and 31 deletions

View File

@@ -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)

View File

@@ -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,27 +363,34 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public async Task CancelTimer(string id)
{
var timers = await GetTimers(new TimerQuery
{
}, CancellationToken.None).ConfigureAwait(false);
var timer = timers.Items
.FirstOrDefault(i => string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase));
var timer = await GetTimer(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);
}
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 service = GetServices(timer.ServiceName, null)
.First();
await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);
}
public async Task<RecordingInfoDto> GetRecording(string id, CancellationToken cancellationToken, User user = null)
{
var results = await GetRecordings(new RecordingQuery
@@ -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);