2013-12-15 01:17:57 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Controller.LiveTv;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
using MediaBrowser.Model.LiveTv;
|
2013-11-25 20:39:23 +00:00
|
|
|
|
using MediaBrowser.Model.Querying;
|
2013-12-07 15:52:38 +00:00
|
|
|
|
using ServiceStack;
|
2013-11-25 20:39:23 +00:00
|
|
|
|
using System;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2013-12-04 04:18:50 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.LiveTv
|
|
|
|
|
{
|
|
|
|
|
[Route("/LiveTv/Services", "GET")]
|
|
|
|
|
[Api(Description = "Gets available live tv services.")]
|
|
|
|
|
public class GetServices : IReturn<List<LiveTvServiceInfo>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/Channels", "GET")]
|
|
|
|
|
[Api(Description = "Gets available live tv channels.")]
|
2013-11-25 20:39:23 +00:00
|
|
|
|
public class GetChannels : IReturn<QueryResult<ChannelInfoDto>>
|
2013-09-26 15:48:14 +00:00
|
|
|
|
{
|
2013-11-24 20:51:45 +00:00
|
|
|
|
[ApiMember(Name = "Type", Description = "Optional filter by channel type.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public ChannelType? Type { get; set; }
|
|
|
|
|
|
2013-12-15 01:17:57 +00:00
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
2013-11-24 20:51:45 +00:00
|
|
|
|
public string UserId { get; set; }
|
2013-09-26 15:48:14 +00:00
|
|
|
|
}
|
2013-10-31 20:45:58 +00:00
|
|
|
|
|
2013-11-24 21:30:38 +00:00
|
|
|
|
[Route("/LiveTv/Channels/{Id}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a live tv channel")]
|
|
|
|
|
public class GetChannel : IReturn<ChannelInfoDto>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
2013-11-26 02:53:48 +00:00
|
|
|
|
|
2013-12-15 01:17:57 +00:00
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
2013-11-26 02:53:48 +00:00
|
|
|
|
public string UserId { get; set; }
|
2013-11-24 21:30:38 +00:00
|
|
|
|
}
|
2013-11-25 16:15:31 +00:00
|
|
|
|
|
2013-11-26 02:53:48 +00:00
|
|
|
|
[Route("/LiveTv/Recordings", "GET")]
|
|
|
|
|
[Api(Description = "Gets live tv recordings")]
|
|
|
|
|
public class GetRecordings : IReturn<QueryResult<RecordingInfoDto>>
|
|
|
|
|
{
|
2013-11-26 21:36:11 +00:00
|
|
|
|
[ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string ChannelId { get; set; }
|
2013-12-15 01:17:57 +00:00
|
|
|
|
|
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string UserId { get; set; }
|
2013-11-26 02:53:48 +00:00
|
|
|
|
}
|
2013-11-26 21:36:11 +00:00
|
|
|
|
|
2013-12-04 04:18:50 +00:00
|
|
|
|
[Route("/LiveTv/Recordings/{Id}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a live tv recording")]
|
|
|
|
|
public class GetRecording : IReturn<RecordingInfoDto>
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
2013-12-15 01:17:57 +00:00
|
|
|
|
|
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string UserId { get; set; }
|
2013-12-04 04:18:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/Timers/{Id}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a live tv timer")]
|
|
|
|
|
public class GetTimer : IReturn<TimerInfoDto>
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-17 20:02:12 +00:00
|
|
|
|
[Route("/LiveTv/Timers/Defaults", "GET")]
|
|
|
|
|
[Api(Description = "Gets default values for a new timer")]
|
2013-12-18 05:44:46 +00:00
|
|
|
|
public class GetDefaultTimer : IReturn<SeriesTimerInfoDto>
|
2013-12-17 20:02:12 +00:00
|
|
|
|
{
|
2013-12-18 05:44:46 +00:00
|
|
|
|
[ApiMember(Name = "ProgramId", Description = "Optional, to attach default values based on a program.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string ProgramId { get; set; }
|
2013-12-17 20:02:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-27 19:04:19 +00:00
|
|
|
|
[Route("/LiveTv/Timers", "GET")]
|
|
|
|
|
[Api(Description = "Gets live tv timers")]
|
|
|
|
|
public class GetTimers : IReturn<QueryResult<TimerInfoDto>>
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string ChannelId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 16:15:31 +00:00
|
|
|
|
[Route("/LiveTv/Programs", "GET")]
|
2013-11-02 21:38:21 +00:00
|
|
|
|
[Api(Description = "Gets available live tv epgs..")]
|
2013-11-25 20:39:23 +00:00
|
|
|
|
public class GetPrograms : IReturn<QueryResult<ProgramInfoDto>>
|
2013-11-02 21:38:21 +00:00
|
|
|
|
{
|
2013-11-25 20:39:23 +00:00
|
|
|
|
[ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
2013-11-15 21:31:44 +00:00
|
|
|
|
public string ChannelIds { get; set; }
|
2013-11-26 02:53:48 +00:00
|
|
|
|
|
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string UserId { get; set; }
|
2013-11-02 21:38:21 +00:00
|
|
|
|
}
|
2013-11-15 21:31:44 +00:00
|
|
|
|
|
2013-12-17 20:02:12 +00:00
|
|
|
|
[Route("/LiveTv/Programs/{Id}", "GET")]
|
|
|
|
|
[Api(Description = "Gets a live tv program")]
|
|
|
|
|
public class GetProgram : IReturn<ProgramInfoDto>
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Program Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
|
|
|
|
[ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
|
|
|
|
public string UserId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-11-29 16:58:24 +00:00
|
|
|
|
[Route("/LiveTv/Recordings/{Id}", "DELETE")]
|
|
|
|
|
[Api(Description = "Deletes a live tv recording")]
|
|
|
|
|
public class DeleteRecording : IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/Timers/{Id}", "DELETE")]
|
|
|
|
|
[Api(Description = "Cancels a live tv timer")]
|
|
|
|
|
public class CancelTimer : IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
2013-12-15 01:17:57 +00:00
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/Timers/{Id}", "POST")]
|
|
|
|
|
[Api(Description = "Updates a live tv timer")]
|
|
|
|
|
public class UpdateTimer : TimerInfoDto, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-17 20:02:12 +00:00
|
|
|
|
[Route("/LiveTv/Timers", "POST")]
|
|
|
|
|
[Api(Description = "Creates a live tv timer")]
|
|
|
|
|
public class CreateTimer : TimerInfoDto, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-15 14:19:24 +00:00
|
|
|
|
[Route("/LiveTv/SeriesTimers/{Id}", "GET")]
|
2013-12-15 01:17:57 +00:00
|
|
|
|
[Api(Description = "Gets a live tv series timer")]
|
|
|
|
|
public class GetSeriesTimer : IReturn<TimerInfoDto>
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/SeriesTimers", "GET")]
|
|
|
|
|
[Api(Description = "Gets live tv series timers")]
|
|
|
|
|
public class GetSeriesTimers : IReturn<QueryResult<SeriesTimerInfoDto>>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-15 14:19:24 +00:00
|
|
|
|
[Route("/LiveTv/SeriesTimers/{Id}", "DELETE")]
|
|
|
|
|
[Api(Description = "Cancels a live tv series timer")]
|
|
|
|
|
public class CancelSeriesTimer : IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/SeriesTimers/{Id}", "POST")]
|
|
|
|
|
[Api(Description = "Updates a live tv series timer")]
|
|
|
|
|
public class UpdateSeriesTimer : SeriesTimerInfoDto, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-17 20:02:12 +00:00
|
|
|
|
[Route("/LiveTv/SeriesTimers", "POST")]
|
|
|
|
|
[Api(Description = "Creates a live tv series timer")]
|
|
|
|
|
public class CreateSeriesTimer : SeriesTimerInfoDto, IReturnVoid
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-22 18:58:51 +00:00
|
|
|
|
[Route("/LiveTv/Recordings/{Id}/Stream", "GET")]
|
|
|
|
|
public class GetInternalRecordingStream
|
|
|
|
|
{
|
|
|
|
|
[ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-26 15:48:14 +00:00
|
|
|
|
public class LiveTvService : BaseApiService
|
|
|
|
|
{
|
|
|
|
|
private readonly ILiveTvManager _liveTvManager;
|
2013-12-15 01:17:57 +00:00
|
|
|
|
private readonly IUserManager _userManager;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
|
2013-12-15 01:17:57 +00:00
|
|
|
|
public LiveTvService(ILiveTvManager liveTvManager, IUserManager userManager)
|
2013-09-26 15:48:14 +00:00
|
|
|
|
{
|
|
|
|
|
_liveTvManager = liveTvManager;
|
2013-12-15 01:17:57 +00:00
|
|
|
|
_userManager = userManager;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-11 19:36:48 +00:00
|
|
|
|
public object Get(GetServices request)
|
|
|
|
|
{
|
2013-12-04 20:55:42 +00:00
|
|
|
|
var services = _liveTvManager.Services
|
2013-11-11 19:36:48 +00:00
|
|
|
|
.Select(GetServiceInfo)
|
2013-09-26 15:48:14 +00:00
|
|
|
|
.ToList();
|
|
|
|
|
|
2013-11-11 19:36:48 +00:00
|
|
|
|
return ToOptimizedResult(services);
|
2013-09-26 15:48:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-31 20:45:58 +00:00
|
|
|
|
private LiveTvServiceInfo GetServiceInfo(ILiveTvService service)
|
|
|
|
|
{
|
|
|
|
|
return new LiveTvServiceInfo
|
|
|
|
|
{
|
|
|
|
|
Name = service.Name
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-26 15:48:14 +00:00
|
|
|
|
public object Get(GetChannels request)
|
|
|
|
|
{
|
2013-11-24 20:51:45 +00:00
|
|
|
|
var result = _liveTvManager.GetChannels(new ChannelQuery
|
|
|
|
|
{
|
|
|
|
|
ChannelType = request.Type,
|
|
|
|
|
UserId = request.UserId
|
2013-09-26 15:48:14 +00:00
|
|
|
|
|
2013-12-15 01:17:57 +00:00
|
|
|
|
}, CancellationToken.None).Result;
|
2013-09-26 15:48:14 +00:00
|
|
|
|
|
2013-11-25 20:39:23 +00:00
|
|
|
|
return ToOptimizedResult(result);
|
2013-09-26 15:48:14 +00:00
|
|
|
|
}
|
2013-10-31 20:45:58 +00:00
|
|
|
|
|
2013-11-24 21:30:38 +00:00
|
|
|
|
public object Get(GetChannel request)
|
|
|
|
|
{
|
2013-12-15 01:17:57 +00:00
|
|
|
|
var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
|
|
|
|
|
|
|
|
|
|
var result = _liveTvManager.GetChannel(request.Id, CancellationToken.None, user).Result;
|
2013-11-24 21:30:38 +00:00
|
|
|
|
|
2013-11-26 02:53:48 +00:00
|
|
|
|
return ToOptimizedResult(result);
|
2013-11-24 21:30:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 16:15:31 +00:00
|
|
|
|
public object Get(GetPrograms request)
|
2013-11-02 21:38:21 +00:00
|
|
|
|
{
|
2013-11-25 16:15:31 +00:00
|
|
|
|
var result = _liveTvManager.GetPrograms(new ProgramQuery
|
|
|
|
|
{
|
2013-11-26 02:53:48 +00:00
|
|
|
|
ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray(),
|
|
|
|
|
UserId = request.UserId
|
2013-11-26 21:36:11 +00:00
|
|
|
|
|
|
|
|
|
}, CancellationToken.None).Result;
|
2013-11-02 21:38:21 +00:00
|
|
|
|
|
2013-11-25 20:39:23 +00:00
|
|
|
|
return ToOptimizedResult(result);
|
2013-11-02 21:38:21 +00:00
|
|
|
|
}
|
2013-11-26 02:53:48 +00:00
|
|
|
|
|
|
|
|
|
public object Get(GetRecordings request)
|
|
|
|
|
{
|
2013-11-26 21:36:11 +00:00
|
|
|
|
var result = _liveTvManager.GetRecordings(new RecordingQuery
|
|
|
|
|
{
|
2013-12-15 01:17:57 +00:00
|
|
|
|
ChannelId = request.ChannelId,
|
|
|
|
|
UserId = request.UserId
|
2013-11-26 21:36:11 +00:00
|
|
|
|
|
|
|
|
|
}, CancellationToken.None).Result;
|
2013-11-26 02:53:48 +00:00
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
2013-11-27 19:04:19 +00:00
|
|
|
|
|
2013-12-04 04:18:50 +00:00
|
|
|
|
public object Get(GetRecording request)
|
|
|
|
|
{
|
2013-12-15 01:17:57 +00:00
|
|
|
|
var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
|
|
|
|
|
|
|
|
|
|
var result = _liveTvManager.GetRecording(request.Id, CancellationToken.None, user).Result;
|
2013-12-04 04:18:50 +00:00
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetTimer request)
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetTimer(request.Id, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-27 19:04:19 +00:00
|
|
|
|
public object Get(GetTimers request)
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetTimers(new TimerQuery
|
|
|
|
|
{
|
2013-12-04 20:55:42 +00:00
|
|
|
|
ChannelId = request.ChannelId
|
2013-11-27 19:04:19 +00:00
|
|
|
|
|
|
|
|
|
}, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
2013-11-29 16:58:24 +00:00
|
|
|
|
|
|
|
|
|
public void Delete(DeleteRecording request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.DeleteRecording(request.Id);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Delete(CancelTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.CancelTimer(request.Id);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
2013-12-15 01:17:57 +00:00
|
|
|
|
|
|
|
|
|
public void Post(UpdateTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.UpdateTimer(request, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetSeriesTimers request)
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetSeriesTimers(new SeriesTimerQuery
|
2013-12-17 20:02:12 +00:00
|
|
|
|
{
|
2013-12-15 01:17:57 +00:00
|
|
|
|
|
|
|
|
|
}, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetSeriesTimer request)
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetSeriesTimer(request.Id, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
2013-12-15 14:19:24 +00:00
|
|
|
|
|
|
|
|
|
public void Delete(CancelSeriesTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.CancelSeriesTimer(request.Id);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Post(UpdateSeriesTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.UpdateSeriesTimer(request, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
2013-12-17 20:02:12 +00:00
|
|
|
|
|
|
|
|
|
public object Get(GetDefaultTimer request)
|
|
|
|
|
{
|
2013-12-18 05:44:46 +00:00
|
|
|
|
if (string.IsNullOrEmpty(request.ProgramId))
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetNewTimerDefaults(CancellationToken.None).Result;
|
2013-12-17 20:02:12 +00:00
|
|
|
|
|
2013-12-18 05:44:46 +00:00
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var result = _liveTvManager.GetNewTimerDefaults(request.ProgramId, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
2013-12-17 20:02:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Get(GetProgram request)
|
|
|
|
|
{
|
|
|
|
|
var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
|
|
|
|
|
|
|
|
|
|
var result = _liveTvManager.GetProgram(request.Id, CancellationToken.None, user).Result;
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Post(CreateSeriesTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.CreateSeriesTimer(request, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Post(CreateTimer request)
|
|
|
|
|
{
|
|
|
|
|
var task = _liveTvManager.CreateTimer(request, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
}
|
2013-12-22 18:58:51 +00:00
|
|
|
|
|
|
|
|
|
public object Get(GetInternalRecordingStream request)
|
|
|
|
|
{
|
|
|
|
|
var stream = _liveTvManager.GetRecordingStream(request.Id, CancellationToken.None).Result;
|
|
|
|
|
|
|
|
|
|
return ToStreamResult(stream.Stream, stream.MimeType);
|
|
|
|
|
}
|
2013-09-26 15:48:14 +00:00
|
|
|
|
}
|
2013-11-02 21:38:21 +00:00
|
|
|
|
}
|