2015-07-25 17:21:10 +00:00
using MediaBrowser.Common.Configuration ;
2015-07-29 17:16:00 +00:00
using MediaBrowser.Common.Net ;
2015-07-21 04:22:46 +00:00
using MediaBrowser.Controller.Dto ;
2015-04-12 18:58:21 +00:00
using MediaBrowser.Controller.Library ;
2013-12-15 01:17:57 +00:00
using MediaBrowser.Controller.LiveTv ;
2014-07-02 18:34:08 +00:00
using MediaBrowser.Controller.Net ;
2014-06-07 19:46:24 +00:00
using MediaBrowser.Model.Dto ;
2014-01-11 23:07:56 +00:00
using MediaBrowser.Model.Entities ;
2013-09-26 15:48:14 +00:00
using MediaBrowser.Model.LiveTv ;
2013-11-25 20:39:23 +00:00
using MediaBrowser.Model.Querying ;
using System ;
2015-07-25 17:21:10 +00:00
using System.Collections.Generic ;
2014-01-10 13:52:01 +00:00
using System.Globalization ;
2016-09-25 18:39:13 +00:00
using System.IO ;
2013-09-26 15:48:14 +00:00
using System.Linq ;
2013-12-04 04:18:50 +00:00
using System.Threading ;
using System.Threading.Tasks ;
2017-09-04 19:28:22 +00:00
using MediaBrowser.Api.UserLibrary ;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Model.IO ;
2017-05-26 06:48:54 +00:00
2016-09-25 18:39:13 +00:00
using MediaBrowser.Controller.Configuration ;
2016-10-18 18:23:41 +00:00
using MediaBrowser.Controller.Entities.TV ;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Model.Services ;
2017-05-22 04:54:02 +00:00
using MediaBrowser.Model.System ;
2017-08-09 19:56:38 +00:00
using MediaBrowser.Model.Extensions ;
2013-09-26 15:48:14 +00:00
namespace MediaBrowser.Api.LiveTv
{
2014-10-16 03:26:39 +00:00
/// <summary>
/// This is insecure right now to avoid windows phone refactoring
/// </summary>
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Info", "GET", Summary = "Gets available live tv services.")]
2014-11-15 02:31:03 +00:00
[Authenticated]
2014-01-14 20:03:35 +00:00
public class GetLiveTvInfo : IReturn < LiveTvInfo >
2013-09-26 15:48:14 +00:00
{
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Channels", "GET", Summary = "Gets available live tv channels.")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-08-02 17:02:23 +00:00
public class GetChannels : IReturn < QueryResult < ChannelInfoDto > > , IHasDtoOptions
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")]
2014-06-01 04:11:04 +00:00
public ChannelType ? Type { get ; set ; }
2013-11-24 20:51:45 +00:00
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 ; }
2014-01-10 13:52:01 +00:00
/// <summary>
/// Skips over a given number of items within the results. Use for paging.
/// </summary>
/// <value>The start index.</value>
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? StartIndex { get ; set ; }
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsMovie { get ; set ; }
[ApiMember(Name = "IsSeries", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSeries { get ; set ; }
[ApiMember(Name = "IsNews", Description = "Optional filter for news.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsNews { get ; set ; }
[ApiMember(Name = "IsKids", Description = "Optional filter for kids.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsKids { get ; set ; }
[ApiMember(Name = "IsSports", Description = "Optional filter for sports.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSports { get ; set ; }
2014-01-10 13:52:01 +00:00
/// <summary>
/// The maximum number of items to return
/// </summary>
/// <value>The limit.</value>
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get ; set ; }
2014-03-29 02:28:02 +00:00
[ApiMember(Name = "IsFavorite", Description = "Filter by channels that are favorites, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsFavorite { get ; set ; }
2014-05-23 23:58:28 +00:00
[ApiMember(Name = "IsLiked", Description = "Filter by channels that are liked, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsLiked { get ; set ; }
[ApiMember(Name = "IsDisliked", Description = "Filter by channels that are disliked, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsDisliked { get ; set ; }
2014-09-26 03:47:46 +00:00
[ApiMember(Name = "EnableFavoriteSorting", Description = "Incorporate favorite and like status into channel sorting.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool EnableFavoriteSorting { get ; set ; }
2015-08-02 17:02:23 +00:00
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get ; set ; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get ; set ; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get ; set ; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
2017-04-29 06:22:33 +00:00
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
2015-08-02 17:02:23 +00:00
public string Fields { get ; set ; }
2015-08-25 03:13:04 +00:00
[ApiMember(Name = "AddCurrentProgram", Description = "Optional. Adds current program info to each channel", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public bool AddCurrentProgram { get ; set ; }
2016-08-17 19:28:43 +00:00
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get ; set ; }
2016-09-30 06:50:06 +00:00
public string SortBy { get ; set ; }
public SortOrder ? SortOrder { get ; set ; }
/// <summary>
/// Gets the order by.
/// </summary>
/// <returns>IEnumerable{ItemSortBy}.</returns>
public string [ ] GetOrderBy ( )
{
var val = SortBy ;
if ( string . IsNullOrEmpty ( val ) )
{
return new string [ ] { } ;
}
return val . Split ( ',' ) ;
}
2015-08-25 03:13:04 +00:00
public GetChannels ( )
{
AddCurrentProgram = true ;
}
2013-09-26 15:48:14 +00:00
}
2013-10-31 20:45:58 +00:00
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-11-24 21:30:38 +00:00
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
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Recordings", "GET", Summary = "Gets live tv recordings")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-08-02 17:02:23 +00:00
public class GetRecordings : IReturn < QueryResult < BaseItemDto > > , IHasDtoOptions
2013-11-26 02:53:48 +00:00
{
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-12-28 21:37:01 +00:00
[ApiMember(Name = "GroupId", Description = "Optional filter by recording group.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string GroupId { get ; set ; }
2013-12-28 23:09:24 +00:00
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? StartIndex { get ; set ; }
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get ; set ; }
2014-01-01 18:26:31 +00:00
2014-01-15 15:18:31 +00:00
[ApiMember(Name = "Status", Description = "Optional filter by recording status.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public RecordingStatus ? Status { get ; set ; }
2014-01-08 05:25:21 +00:00
2014-01-15 15:18:31 +00:00
[ApiMember(Name = "Status", Description = "Optional filter by recordings that are in progress, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsInProgress { get ; set ; }
2014-01-16 17:23:30 +00:00
2014-01-08 05:25:21 +00:00
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get ; set ; }
2015-08-02 17:02:23 +00:00
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get ; set ; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get ; set ; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get ; set ; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
2017-04-29 06:22:33 +00:00
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
2015-08-02 17:02:23 +00:00
public string Fields { get ; set ; }
2016-06-20 17:07:53 +00:00
public bool EnableTotalRecordCount { get ; set ; }
2016-08-17 19:28:43 +00:00
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get ; set ; }
2016-09-05 05:39:14 +00:00
public bool? IsMovie { get ; set ; }
public bool? IsSeries { get ; set ; }
2016-09-06 17:59:10 +00:00
public bool? IsKids { get ; set ; }
public bool? IsSports { get ; set ; }
2016-09-29 12:55:49 +00:00
public bool? IsNews { get ; set ; }
2016-12-20 05:21:21 +00:00
public bool? IsLibraryItem { get ; set ; }
2016-09-05 05:39:14 +00:00
2016-06-20 17:07:53 +00:00
public GetRecordings ( )
{
EnableTotalRecordCount = true ;
}
2013-12-28 21:37:01 +00:00
}
2016-09-06 17:59:10 +00:00
[Route("/LiveTv/Recordings/Series", "GET", Summary = "Gets live tv recordings")]
[Authenticated]
public class GetRecordingSeries : IReturn < QueryResult < BaseItemDto > > , IHasDtoOptions
{
[ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ChannelId { get ; set ; }
[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 ; }
[ApiMember(Name = "GroupId", Description = "Optional filter by recording group.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string GroupId { get ; set ; }
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? StartIndex { get ; set ; }
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get ; set ; }
[ApiMember(Name = "Status", Description = "Optional filter by recording status.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public RecordingStatus ? Status { get ; set ; }
[ApiMember(Name = "Status", Description = "Optional filter by recordings that are in progress, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsInProgress { get ; set ; }
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get ; set ; }
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get ; set ; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get ; set ; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get ; set ; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
2017-04-29 06:22:33 +00:00
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
2016-09-06 17:59:10 +00:00
public string Fields { get ; set ; }
public bool EnableTotalRecordCount { get ; set ; }
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get ; set ; }
public GetRecordingSeries ( )
{
EnableTotalRecordCount = true ;
}
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-05-31 18:22:51 +00:00
public class GetRecordingGroups : IReturn < QueryResult < BaseItemDto > >
2013-12-28 21:37:01 +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
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Recordings/{Id}", "GET", Summary = "Gets a live tv recording")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-05-31 18:22:51 +00:00
public class GetRecording : IReturn < BaseItemDto >
2013-12-04 04:18:50 +00:00
{
[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
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Tuners/{Id}/Reset", "POST", Summary = "Resets a tv tuner")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2014-01-23 22:15:15 +00:00
public class ResetTuner : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Tuner Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers/{Id}", "GET", Summary = "Gets a live tv timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-04 04:18:50 +00:00
public class GetTimer : IReturn < TimerInfoDto >
{
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers/Defaults", "GET", Summary = "Gets default values for a new timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
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
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers", "GET", Summary = "Gets live tv timers")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-11-27 19:04:19 +00:00
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 ; }
2014-01-08 05:25:21 +00:00
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by timers belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get ; set ; }
2016-06-19 17:41:49 +00:00
public bool? IsActive { get ; set ; }
2016-10-04 05:15:39 +00:00
public bool? IsScheduled { get ; set ; }
2013-11-27 19:04:19 +00:00
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-08-02 17:02:23 +00:00
public class GetPrograms : IReturn < QueryResult < BaseItemDto > > , IHasDtoOptions
2013-11-02 21:38:21 +00:00
{
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2013-11-15 21:31:44 +00:00
public string ChannelIds { get ; set ; }
2013-11-26 02:53:48 +00:00
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2013-11-26 02:53:48 +00:00
public string UserId { get ; set ; }
2014-01-06 01:59:21 +00:00
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "MinStartDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2014-01-06 01:59:21 +00:00
public string MinStartDate { get ; set ; }
2015-03-07 03:53:31 +00:00
[ApiMember(Name = "HasAired", Description = "Optional. Filter by programs that have completed airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? HasAired { get ; set ; }
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2014-01-06 01:59:21 +00:00
public string MaxStartDate { get ; set ; }
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "MinEndDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2014-01-06 01:59:21 +00:00
public string MinEndDate { get ; set ; }
2014-01-10 13:52:01 +00:00
[ApiMember(Name = "MaxEndDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
2014-01-06 01:59:21 +00:00
public string MaxEndDate { get ; set ; }
2015-03-14 20:00:32 +00:00
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsMovie { get ; set ; }
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsSeries", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSeries { get ; set ; }
[ApiMember(Name = "IsNews", Description = "Optional filter for news.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsNews { get ; set ; }
2015-08-04 14:26:36 +00:00
[ApiMember(Name = "IsKids", Description = "Optional filter for kids.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsKids { get ; set ; }
2015-04-03 16:31:56 +00:00
[ApiMember(Name = "IsSports", Description = "Optional filter for sports.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSports { get ; set ; }
2015-03-14 20:00:32 +00:00
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? StartIndex { get ; set ; }
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get ; set ; }
[ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Name, StartDate", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string SortBy { get ; set ; }
[ApiMember(Name = "SortOrder", Description = "Sort Order - Ascending,Descending", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
2017-09-04 19:28:22 +00:00
public string SortOrder { get ; set ; }
2015-03-14 20:00:32 +00:00
[ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string Genres { get ; set ; }
2015-08-02 17:02:23 +00:00
2017-12-03 22:15:21 +00:00
[ApiMember(Name = "GenreIds", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string GenreIds { get ; set ; }
2015-08-02 17:02:23 +00:00
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get ; set ; }
2016-05-09 03:13:38 +00:00
public bool EnableTotalRecordCount { get ; set ; }
2015-08-02 17:02:23 +00:00
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get ; set ; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get ; set ; }
2016-08-17 19:28:43 +00:00
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get ; set ; }
2016-10-01 07:06:00 +00:00
public string SeriesTimerId { get ; set ; }
2016-10-18 18:23:41 +00:00
public string LibrarySeriesId { get ; set ; }
2016-10-01 07:06:00 +00:00
2015-08-02 17:02:23 +00:00
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
2017-04-29 06:22:33 +00:00
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
2015-08-02 17:02:23 +00:00
public string Fields { get ; set ; }
2016-05-09 03:13:38 +00:00
public GetPrograms ( )
{
EnableTotalRecordCount = true ;
}
2013-11-02 21:38:21 +00:00
}
2013-11-15 21:31:44 +00:00
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Programs/Recommended", "GET", Summary = "Gets available live tv epgs..")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-08-02 17:02:23 +00:00
public class GetRecommendedPrograms : IReturn < QueryResult < BaseItemDto > > , IHasDtoOptions
2014-01-12 15:58:47 +00:00
{
2016-05-09 03:13:38 +00:00
public bool EnableTotalRecordCount { get ; set ; }
public GetRecommendedPrograms ( )
{
EnableTotalRecordCount = true ;
}
2014-01-12 15:58:47 +00:00
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string UserId { get ; set ; }
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get ; set ; }
[ApiMember(Name = "IsAiring", Description = "Optional. Filter by programs that are currently airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsAiring { get ; set ; }
[ApiMember(Name = "HasAired", Description = "Optional. Filter by programs that have completed airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? HasAired { get ; set ; }
2015-03-14 20:00:32 +00:00
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsSeries", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSeries { get ; set ; }
2015-04-03 16:31:56 +00:00
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
2015-03-14 20:00:32 +00:00
public bool? IsMovie { get ; set ; }
2015-08-02 17:02:23 +00:00
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsNews", Description = "Optional filter for news.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsNews { get ; set ; }
[ApiMember(Name = "IsKids", Description = "Optional filter for kids.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
2015-08-04 14:26:36 +00:00
public bool? IsKids { get ; set ; }
2016-09-29 12:55:49 +00:00
[ApiMember(Name = "IsSports", Description = "Optional filter for sports.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
public bool? IsSports { get ; set ; }
2015-08-02 17:02:23 +00:00
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get ; set ; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get ; set ; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get ; set ; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
2017-04-29 06:22:33 +00:00
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
2015-08-02 17:02:23 +00:00
public string Fields { get ; set ; }
2016-08-17 19:28:43 +00:00
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get ; set ; }
2014-01-12 15:58:47 +00:00
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-05-31 19:12:58 +00:00
public class GetProgram : IReturn < BaseItemDto >
2013-12-17 20:02:12 +00:00
{
[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 ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Recordings/{Id}", "DELETE", Summary = "Deletes a live tv recording")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-11-29 16:58:24 +00:00
public class DeleteRecording : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers/{Id}", "DELETE", Summary = "Cancels a live tv timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-11-29 16:58:24 +00:00
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
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers/{Id}", "POST", Summary = "Updates a live tv timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-15 01:17:57 +00:00
public class UpdateTimer : TimerInfoDto , IReturnVoid
{
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Timers", "POST", Summary = "Creates a live tv timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-17 20:02:12 +00:00
public class CreateTimer : TimerInfoDto , IReturnVoid
{
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/SeriesTimers/{Id}", "GET", Summary = "Gets a live tv series timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-15 01:17:57 +00:00
public class GetSeriesTimer : IReturn < TimerInfoDto >
{
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/SeriesTimers", "GET", Summary = "Gets live tv series timers")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-15 01:17:57 +00:00
public class GetSeriesTimers : IReturn < QueryResult < SeriesTimerInfoDto > >
{
2014-01-11 23:07:56 +00:00
[ApiMember(Name = "SortBy", Description = "Optional. Sort by SortName or Priority", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string SortBy { get ; set ; }
[ApiMember(Name = "SortOrder", Description = "Optional. Sort in Ascending or Descending order", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public SortOrder SortOrder { get ; set ; }
2013-12-15 01:17:57 +00:00
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/SeriesTimers/{Id}", "DELETE", Summary = "Cancels a live tv series timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-15 14:19:24 +00:00
public class CancelSeriesTimer : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/SeriesTimers/{Id}", "POST", Summary = "Updates a live tv series timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-15 14:19:24 +00:00
public class UpdateSeriesTimer : SeriesTimerInfoDto , IReturnVoid
{
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/SeriesTimers", "POST", Summary = "Creates a live tv series timer")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2013-12-17 20:02:12 +00:00
public class CreateSeriesTimer : SeriesTimerInfoDto , IReturnVoid
{
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/Recordings/Groups/{Id}", "GET", Summary = "Gets a recording group")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2015-05-31 18:22:51 +00:00
public class GetRecordingGroup : IReturn < BaseItemDto >
2014-01-02 03:53:27 +00:00
{
[ApiMember(Name = "Id", Description = "Recording group Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get ; set ; }
}
2014-03-26 16:10:46 +00:00
[Route("/LiveTv/GuideInfo", "GET", Summary = "Gets guide info")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2014-01-07 18:39:35 +00:00
public class GetGuideInfo : IReturn < GuideInfo >
{
}
2014-06-07 19:46:24 +00:00
[Route("/LiveTv/Folder", "GET", Summary = "Gets the users live tv folder, along with configured images")]
2014-10-15 12:46:24 +00:00
[Authenticated]
2014-06-07 19:46:24 +00:00
public class GetLiveTvFolder : IReturn < BaseItemDto >
{
[ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string UserId { get ; set ; }
}
2015-07-21 04:22:46 +00:00
[Route("/LiveTv/TunerHosts", "POST", Summary = "Adds a tuner host")]
[Authenticated]
2015-07-25 18:11:46 +00:00
public class AddTunerHost : TunerHostInfo , IReturn < TunerHostInfo >
2015-07-21 04:22:46 +00:00
{
}
[Route("/LiveTv/TunerHosts", "DELETE", Summary = "Deletes a tuner host")]
[Authenticated]
public class DeleteTunerHost : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Tuner host id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "DELETE")]
public string Id { get ; set ; }
}
2016-06-03 19:32:10 +00:00
[Route("/LiveTv/ListingProviders/Default", "GET")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2016-06-03 19:32:10 +00:00
public class GetDefaultListingProvider : ListingsProviderInfo , IReturn < ListingsProviderInfo >
{
}
2015-07-23 13:23:22 +00:00
[Route("/LiveTv/ListingProviders", "POST", Summary = "Adds a listing provider")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2015-07-23 13:23:22 +00:00
public class AddListingProvider : ListingsProviderInfo , IReturn < ListingsProviderInfo >
{
2015-07-25 17:21:10 +00:00
public bool ValidateLogin { get ; set ; }
public bool ValidateListings { get ; set ; }
2015-07-23 13:23:22 +00:00
}
[Route("/LiveTv/ListingProviders", "DELETE", Summary = "Deletes a listing provider")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2015-07-23 13:23:22 +00:00
public class DeleteListingProvider : IReturnVoid
{
[ApiMember(Name = "Id", Description = "Provider id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "DELETE")]
public string Id { get ; set ; }
}
[Route("/LiveTv/ListingProviders/Lineups", "GET", Summary = "Gets available lineups")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2015-07-23 13:23:22 +00:00
public class GetLineups : IReturn < List < NameIdPair > >
{
[ApiMember(Name = "Id", Description = "Provider id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Id { get ; set ; }
2015-08-10 19:09:10 +00:00
[ApiMember(Name = "Type", Description = "Provider Type", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Type { get ; set ; }
2015-07-23 13:23:22 +00:00
[ApiMember(Name = "Location", Description = "Location", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Location { get ; set ; }
2015-07-23 17:58:20 +00:00
[ApiMember(Name = "Country", Description = "Country", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Country { get ; set ; }
2015-07-23 13:23:22 +00:00
}
2015-07-29 17:16:00 +00:00
[Route("/LiveTv/ListingProviders/SchedulesDirect/Countries", "GET", Summary = "Gets available lineups")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2015-07-29 17:16:00 +00:00
public class GetSchedulesDirectCountries
{
}
2016-06-09 16:13:25 +00:00
[Route("/LiveTv/ChannelMappingOptions")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2016-06-09 16:13:25 +00:00
public class GetChannelMappingOptions
{
[ApiMember(Name = "Id", Description = "Provider id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ProviderId { get ; set ; }
}
2016-06-10 17:34:08 +00:00
[Route("/LiveTv/ChannelMappings")]
2017-03-13 18:57:45 +00:00
[Authenticated]
2016-06-10 17:34:08 +00:00
public class SetChannelMapping
{
[ApiMember(Name = "Id", Description = "Provider id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ProviderId { get ; set ; }
2017-02-04 23:32:16 +00:00
public string TunerChannelId { get ; set ; }
public string ProviderChannelId { get ; set ; }
2016-06-10 17:34:08 +00:00
}
2016-06-09 16:13:25 +00:00
public class ChannelMappingOptions
{
public List < TunerChannelMapping > TunerChannels { get ; set ; }
public List < NameIdPair > ProviderChannels { get ; set ; }
2017-08-19 19:43:35 +00:00
public NameValuePair [ ] Mappings { get ; set ; }
2016-06-09 16:13:25 +00:00
public string ProviderName { get ; set ; }
}
2015-08-21 19:25:35 +00:00
[Route("/LiveTv/Registration", "GET")]
[Authenticated]
public class GetLiveTvRegistrationInfo : IReturn < MBRegistrationRecord >
{
[ApiMember(Name = "Feature", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Feature { get ; set ; }
}
2015-08-22 17:11:14 +00:00
2016-09-25 18:39:13 +00:00
[Route("/LiveTv/LiveStreamFiles/{Id}/stream.{Container}", "GET", Summary = "Gets a live tv channel")]
public class GetLiveStreamFile
{
public string Id { get ; set ; }
public string Container { get ; set ; }
}
2016-10-09 07:18:43 +00:00
[Route("/LiveTv/LiveRecordings/{Id}/stream", "GET", Summary = "Gets a live tv channel")]
public class GetLiveRecordingFile
{
public string Id { get ; set ; }
}
2017-03-13 18:57:45 +00:00
[Route("/LiveTv/TunerHosts/Types", "GET")]
[Authenticated]
public class GetTunerHostTypes : IReturn < List < NameIdPair > >
{
2017-03-13 20:42:21 +00:00
}
[Route("/LiveTv/Tuners/Discvover", "GET")]
[Authenticated]
public class DiscoverTuners : IReturn < List < TunerHostInfo > >
{
2017-03-15 19:57:18 +00:00
public bool NewDevicesOnly { get ; set ; }
2017-03-13 18:57:45 +00:00
}
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 ;
2016-09-25 18:39:13 +00:00
private readonly IServerConfigurationManager _config ;
2015-07-29 17:16:00 +00:00
private readonly IHttpClient _httpClient ;
2016-03-22 06:49:36 +00:00
private readonly ILibraryManager _libraryManager ;
private readonly IDtoService _dtoService ;
2016-09-25 18:39:13 +00:00
private readonly IFileSystem _fileSystem ;
2016-11-10 14:41:24 +00:00
private readonly IAuthorizationContext _authContext ;
private readonly ISessionContext _sessionContext ;
2017-05-22 04:54:02 +00:00
private readonly IEnvironmentInfo _environment ;
2013-09-26 15:48:14 +00:00
2017-05-22 04:54:02 +00:00
public LiveTvService ( ILiveTvManager liveTvManager , IUserManager userManager , IServerConfigurationManager config , IHttpClient httpClient , ILibraryManager libraryManager , IDtoService dtoService , IFileSystem fileSystem , IAuthorizationContext authContext , ISessionContext sessionContext , IEnvironmentInfo environment )
2013-09-26 15:48:14 +00:00
{
_liveTvManager = liveTvManager ;
2013-12-15 01:17:57 +00:00
_userManager = userManager ;
2015-07-21 04:22:46 +00:00
_config = config ;
2015-07-29 17:16:00 +00:00
_httpClient = httpClient ;
2016-03-22 06:49:36 +00:00
_libraryManager = libraryManager ;
_dtoService = dtoService ;
2016-09-25 18:39:13 +00:00
_fileSystem = fileSystem ;
2016-11-10 14:41:24 +00:00
_authContext = authContext ;
_sessionContext = sessionContext ;
2017-05-22 04:54:02 +00:00
_environment = environment ;
2016-09-25 18:39:13 +00:00
}
2017-03-13 18:57:45 +00:00
public object Get ( GetTunerHostTypes request )
{
var list = _liveTvManager . GetTunerHostTypes ( ) ;
return ToOptimizedResult ( list ) ;
}
2016-11-01 03:07:45 +00:00
public object Get ( GetLiveRecordingFile request )
2016-10-09 07:18:43 +00:00
{
2016-11-01 03:07:45 +00:00
var path = _liveTvManager . GetEmbyTvActiveRecordingPath ( request . Id ) ;
2016-10-09 07:18:43 +00:00
2016-11-01 03:07:45 +00:00
if ( string . IsNullOrWhiteSpace ( path ) )
2016-10-09 07:18:43 +00:00
{
throw new FileNotFoundException ( ) ;
}
var outputHeaders = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
outputHeaders [ "Content-Type" ] = Model . Net . MimeTypes . GetMimeType ( path ) ;
2017-10-14 06:52:56 +00:00
return new ProgressiveFileCopier ( _fileSystem , path , outputHeaders , Logger , _environment )
2016-10-09 07:18:43 +00:00
{
AllowEndOfFile = false
} ;
}
2017-03-13 20:42:21 +00:00
public async Task < object > Get ( DiscoverTuners request )
{
2017-03-15 19:57:18 +00:00
var result = await _liveTvManager . DiscoverTuners ( request . NewDevicesOnly , CancellationToken . None ) . ConfigureAwait ( false ) ;
2017-03-13 20:42:21 +00:00
return ToOptimizedResult ( result ) ;
}
2016-10-07 15:53:00 +00:00
public async Task < object > Get ( GetLiveStreamFile request )
2016-09-25 18:39:13 +00:00
{
2016-11-01 03:07:45 +00:00
var directStreamProvider = ( await _liveTvManager . GetEmbyTvLiveStream ( request . Id ) . ConfigureAwait ( false ) ) as IDirectStreamProvider ;
2016-09-25 18:39:13 +00:00
var outputHeaders = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
2016-10-09 07:18:43 +00:00
outputHeaders [ "Content-Type" ] = Model . Net . MimeTypes . GetMimeType ( "file." + request . Container ) ;
2016-09-30 06:50:06 +00:00
2017-10-14 06:52:56 +00:00
return new ProgressiveFileCopier ( directStreamProvider , outputHeaders , Logger , _environment )
2016-09-25 18:39:13 +00:00
{
2016-10-07 15:53:00 +00:00
AllowEndOfFile = false
2016-09-25 18:39:13 +00:00
} ;
2015-07-29 17:16:00 +00:00
}
2015-08-21 19:25:35 +00:00
2016-06-03 19:32:10 +00:00
public object Get ( GetDefaultListingProvider request )
{
return ToOptimizedResult ( new ListingsProviderInfo ( ) ) ;
}
2015-08-21 19:25:35 +00:00
public async Task < object > Get ( GetLiveTvRegistrationInfo request )
{
2016-09-06 05:02:05 +00:00
var result = await _liveTvManager . GetRegistrationInfo ( request . Feature ) . ConfigureAwait ( false ) ;
2015-08-21 19:25:35 +00:00
return ToOptimizedResult ( result ) ;
}
2015-07-29 17:16:00 +00:00
2016-06-10 17:34:08 +00:00
public async Task < object > Post ( SetChannelMapping request )
{
2017-02-04 23:32:16 +00:00
return await _liveTvManager . SetChannelMapping ( request . ProviderId , request . TunerChannelId , request . ProviderChannelId ) . ConfigureAwait ( false ) ;
2016-06-10 17:34:08 +00:00
}
2016-06-09 16:13:25 +00:00
public async Task < object > Get ( GetChannelMappingOptions request )
{
var config = GetConfiguration ( ) ;
2016-06-10 16:45:04 +00:00
var listingsProviderInfo = config . ListingProviders . First ( i = > string . Equals ( request . ProviderId , i . Id , StringComparison . OrdinalIgnoreCase ) ) ;
var listingsProviderName = _liveTvManager . ListingProviders . First ( i = > string . Equals ( i . Type , listingsProviderInfo . Type , StringComparison . OrdinalIgnoreCase ) ) . Name ;
2016-06-09 16:13:25 +00:00
var tunerChannels = await _liveTvManager . GetChannelsForListingsProvider ( request . ProviderId , CancellationToken . None )
. ConfigureAwait ( false ) ;
var providerChannels = await _liveTvManager . GetChannelsFromListingsProviderData ( request . ProviderId , CancellationToken . None )
. ConfigureAwait ( false ) ;
2017-08-19 19:43:35 +00:00
var mappings = listingsProviderInfo . ChannelMappings ;
2016-06-09 16:13:25 +00:00
var result = new ChannelMappingOptions
{
2016-06-30 19:01:48 +00:00
TunerChannels = tunerChannels . Select ( i = > _liveTvManager . GetTunerChannelMapping ( i , mappings , providerChannels ) ) . ToList ( ) ,
2016-06-09 16:13:25 +00:00
ProviderChannels = providerChannels . Select ( i = > new NameIdPair
{
Name = i . Name ,
2017-02-23 19:13:07 +00:00
Id = i . Id
2016-06-09 16:13:25 +00:00
} ) . ToList ( ) ,
Mappings = mappings ,
2016-06-10 16:45:04 +00:00
ProviderName = listingsProviderName
2016-06-09 16:13:25 +00:00
} ;
return ToOptimizedResult ( result ) ;
}
2015-07-29 17:16:00 +00:00
public async Task < object > Get ( GetSchedulesDirectCountries request )
{
// https://json.schedulesdirect.org/20141201/available/countries
var response = await _httpClient . Get ( new HttpRequestOptions
{
2016-10-06 18:55:01 +00:00
Url = "https://json.schedulesdirect.org/20141201/available/countries" ,
BufferContent = false
2015-07-29 17:16:00 +00:00
} ) . ConfigureAwait ( false ) ;
return ResultFactory . GetResult ( response , "application/json" ) ;
2013-09-26 15:48:14 +00:00
}
2014-01-13 20:31:09 +00:00
private void AssertUserCanManageLiveTv ( )
{
2016-11-10 14:41:24 +00:00
var user = _sessionContext . GetUser ( Request ) . Result ;
2014-01-13 20:31:09 +00:00
if ( user = = null )
{
2015-09-26 02:31:13 +00:00
throw new SecurityException ( "Anonymous live tv management is not allowed." ) ;
2014-01-13 20:31:09 +00:00
}
2014-12-20 06:06:27 +00:00
if ( ! user . Policy . EnableLiveTvManagement )
2014-01-13 20:31:09 +00:00
{
2015-09-26 02:31:13 +00:00
throw new SecurityException ( "The current user does not have permission to manage live tv." ) ;
2014-01-13 20:31:09 +00:00
}
}
2015-07-25 17:21:10 +00:00
public async Task < object > Post ( AddListingProvider request )
2015-07-23 13:23:22 +00:00
{
2015-07-25 17:21:10 +00:00
var result = await _liveTvManager . SaveListingProvider ( request , request . ValidateLogin , request . ValidateListings ) . ConfigureAwait ( false ) ;
2015-07-23 13:23:22 +00:00
return ToOptimizedResult ( result ) ;
}
public void Delete ( DeleteListingProvider request )
2015-07-21 04:22:46 +00:00
{
2016-06-30 19:01:48 +00:00
_liveTvManager . DeleteListingsProvider ( request . Id ) ;
2015-07-21 04:22:46 +00:00
}
2015-07-25 18:11:46 +00:00
public async Task < object > Post ( AddTunerHost request )
2015-07-23 13:23:22 +00:00
{
2017-08-16 03:40:36 +00:00
request . EnableNewHdhrChannelIds = true ;
2015-07-25 18:11:46 +00:00
var result = await _liveTvManager . SaveTunerHost ( request ) . ConfigureAwait ( false ) ;
return ToOptimizedResult ( result ) ;
2015-07-23 13:23:22 +00:00
}
2015-07-21 04:22:46 +00:00
public void Delete ( DeleteTunerHost request )
{
var config = GetConfiguration ( ) ;
2017-08-19 19:43:35 +00:00
config . TunerHosts = config . TunerHosts . Where ( i = > ! string . Equals ( request . Id , i . Id , StringComparison . OrdinalIgnoreCase ) ) . ToArray ( ) ;
2015-07-21 04:22:46 +00:00
_config . SaveConfiguration ( "livetv" , config ) ;
}
private LiveTvOptions GetConfiguration ( )
{
return _config . GetConfiguration < LiveTvOptions > ( "livetv" ) ;
}
2016-06-10 17:34:08 +00:00
private void UpdateConfiguration ( LiveTvOptions options )
{
_config . SaveConfiguration ( "livetv" , options ) ;
}
2015-07-23 13:23:22 +00:00
public async Task < object > Get ( GetLineups request )
{
2015-08-10 19:09:10 +00:00
var info = await _liveTvManager . GetLineups ( request . Type , request . Id , request . Country , request . Location ) . ConfigureAwait ( false ) ;
2015-07-23 13:23:22 +00:00
return ToOptimizedSerializedResultUsingCache ( info ) ;
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetLiveTvInfo request )
2013-11-11 19:36:48 +00:00
{
2014-08-17 05:38:13 +00:00
var info = await _liveTvManager . GetLiveTvInfo ( CancellationToken . None ) . ConfigureAwait ( false ) ;
2014-01-23 21:09:00 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( info ) ;
2013-09-26 15:48:14 +00:00
}
2017-10-03 18:39:37 +00:00
public object Get ( GetChannels request )
2013-09-26 15:48:14 +00:00
{
2017-05-21 07:25:49 +00:00
var options = GetDtoOptions ( _authContext , request ) ;
2017-10-03 18:39:37 +00:00
var channelResult = _liveTvManager . GetInternalChannels ( new LiveTvChannelQuery
2013-11-24 20:51:45 +00:00
{
ChannelType = request . Type ,
2014-01-10 13:52:01 +00:00
UserId = request . UserId ,
StartIndex = request . StartIndex ,
2014-03-29 02:28:02 +00:00
Limit = request . Limit ,
2014-05-23 23:58:28 +00:00
IsFavorite = request . IsFavorite ,
IsLiked = request . IsLiked ,
2014-09-26 03:47:46 +00:00
IsDisliked = request . IsDisliked ,
2015-08-25 03:13:04 +00:00
EnableFavoriteSorting = request . EnableFavoriteSorting ,
2016-09-29 12:55:49 +00:00
IsMovie = request . IsMovie ,
IsSeries = request . IsSeries ,
IsNews = request . IsNews ,
IsKids = request . IsKids ,
IsSports = request . IsSports ,
2016-09-30 06:50:06 +00:00
SortBy = request . GetOrderBy ( ) ,
SortOrder = request . SortOrder ? ? SortOrder . Ascending ,
2015-08-25 03:13:04 +00:00
AddCurrentProgram = request . AddCurrentProgram
2013-09-26 15:48:14 +00:00
2017-10-03 18:39:37 +00:00
} , options , CancellationToken . None ) ;
2013-09-26 15:48:14 +00:00
2016-03-22 06:49:36 +00:00
var user = string . IsNullOrEmpty ( request . UserId ) ? null : _userManager . GetUserById ( request . UserId ) ;
2016-08-17 19:28:43 +00:00
RemoveFields ( options ) ;
options . AddCurrentProgram = request . AddCurrentProgram ;
2017-08-28 00:33:05 +00:00
var returnArray = _dtoService . GetBaseItemDtos ( channelResult . Items , options , user ) ;
2016-03-22 06:49:36 +00:00
var result = new QueryResult < BaseItemDto >
{
Items = returnArray ,
TotalRecordCount = channelResult . TotalRecordCount
} ;
2016-06-09 16:13:25 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-09-26 15:48:14 +00:00
}
2013-10-31 20:45:58 +00:00
2016-08-17 19:28:43 +00:00
private void RemoveFields ( DtoOptions options )
{
2017-08-19 19:43:35 +00:00
var fields = options . Fields . ToList ( ) ;
fields . Remove ( ItemFields . CanDelete ) ;
fields . Remove ( ItemFields . CanDownload ) ;
fields . Remove ( ItemFields . DisplayPreferencesId ) ;
fields . Remove ( ItemFields . Etag ) ;
options . Fields = fields . ToArray ( fields . Count ) ;
2016-08-17 19:28:43 +00:00
}
2016-03-22 06:49:36 +00:00
public object Get ( GetChannel request )
2013-11-24 21:30:38 +00:00
{
2017-10-13 05:44:20 +00:00
var user = _userManager . GetUserById ( request . UserId ) ;
2016-03-22 06:49:36 +00:00
2017-10-13 05:44:20 +00:00
var item = string . IsNullOrEmpty ( request . Id ) ? user . RootFolder : _libraryManager . GetItemById ( request . Id ) ;
2016-03-22 06:49:36 +00:00
2016-11-10 14:41:24 +00:00
var dtoOptions = GetDtoOptions ( _authContext , request ) ;
2013-12-15 01:17:57 +00:00
2016-03-22 06:49:36 +00:00
var result = _dtoService . GetBaseItemDto ( item , dtoOptions , user ) ;
2013-11-24 21:30:38 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-11-24 21:30:38 +00:00
}
2017-10-03 18:39:37 +00:00
public object Get ( GetLiveTvFolder request )
2014-06-07 19:46:24 +00:00
{
2017-10-03 18:39:37 +00:00
return ToOptimizedResult ( _liveTvManager . GetLiveTvFolder ( request . UserId , CancellationToken . None ) ) ;
2014-06-07 19:46:24 +00:00
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetPrograms request )
2013-11-02 21:38:21 +00:00
{
2014-01-06 01:59:21 +00:00
var query = new ProgramQuery
2013-11-25 16:15:31 +00:00
{
2017-08-09 19:56:38 +00:00
ChannelIds = ApiEntryPoint . Split ( request . ChannelIds , ',' , true ) ,
2015-03-07 03:53:31 +00:00
UserId = request . UserId ,
2016-05-09 03:13:38 +00:00
HasAired = request . HasAired ,
EnableTotalRecordCount = request . EnableTotalRecordCount
2014-01-06 01:59:21 +00:00
} ;
2013-11-26 21:36:11 +00:00
2014-01-06 01:59:21 +00:00
if ( ! string . IsNullOrEmpty ( request . MinStartDate ) )
{
2014-01-07 18:39:35 +00:00
query . MinStartDate = DateTime . Parse ( request . MinStartDate , null , DateTimeStyles . RoundtripKind ) . ToUniversalTime ( ) ;
2014-01-06 01:59:21 +00:00
}
if ( ! string . IsNullOrEmpty ( request . MinEndDate ) )
{
2014-01-07 18:39:35 +00:00
query . MinEndDate = DateTime . Parse ( request . MinEndDate , null , DateTimeStyles . RoundtripKind ) . ToUniversalTime ( ) ;
2014-01-06 01:59:21 +00:00
}
if ( ! string . IsNullOrEmpty ( request . MaxStartDate ) )
{
2014-01-07 18:39:35 +00:00
query . MaxStartDate = DateTime . Parse ( request . MaxStartDate , null , DateTimeStyles . RoundtripKind ) . ToUniversalTime ( ) ;
2014-01-06 01:59:21 +00:00
}
if ( ! string . IsNullOrEmpty ( request . MaxEndDate ) )
{
2014-01-07 18:39:35 +00:00
query . MaxEndDate = DateTime . Parse ( request . MaxEndDate , null , DateTimeStyles . RoundtripKind ) . ToUniversalTime ( ) ;
2014-01-06 01:59:21 +00:00
}
2015-03-14 20:00:32 +00:00
query . StartIndex = request . StartIndex ;
query . Limit = request . Limit ;
2017-09-04 19:28:22 +00:00
query . OrderBy = BaseItemsRequest . GetOrderBy ( request . SortBy , request . SortOrder ) ;
2016-09-29 12:55:49 +00:00
query . IsNews = request . IsNews ;
2015-03-14 20:00:32 +00:00
query . IsMovie = request . IsMovie ;
2016-09-29 12:55:49 +00:00
query . IsSeries = request . IsSeries ;
2015-08-04 14:26:36 +00:00
query . IsKids = request . IsKids ;
2015-04-03 16:31:56 +00:00
query . IsSports = request . IsSports ;
2016-10-01 07:06:00 +00:00
query . SeriesTimerId = request . SeriesTimerId ;
2015-03-14 20:00:32 +00:00
query . Genres = ( request . Genres ? ? String . Empty ) . Split ( new [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) ;
2017-12-03 22:15:21 +00:00
query . GenreIds = ( request . GenreIds ? ? String . Empty ) . Split ( new [ ] { '|' } , StringSplitOptions . RemoveEmptyEntries ) ;
2015-03-14 20:00:32 +00:00
2016-10-18 18:23:41 +00:00
if ( ! string . IsNullOrWhiteSpace ( request . LibrarySeriesId ) )
{
query . IsSeries = true ;
var series = _libraryManager . GetItemById ( request . LibrarySeriesId ) as Series ;
if ( series ! = null )
{
query . Name = series . Name ;
}
}
2016-11-10 14:41:24 +00:00
var result = await _liveTvManager . GetPrograms ( query , GetDtoOptions ( _authContext , request ) , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-11-02 21:38:21 +00:00
2015-04-09 05:20:23 +00:00
return ToOptimizedResult ( result ) ;
2014-01-12 15:58:47 +00:00
}
2017-10-03 18:39:37 +00:00
public object Get ( GetRecommendedPrograms request )
2014-01-12 15:58:47 +00:00
{
var query = new RecommendedProgramQuery
{
UserId = request . UserId ,
IsAiring = request . IsAiring ,
Limit = request . Limit ,
2015-03-14 20:00:32 +00:00
HasAired = request . HasAired ,
2016-09-29 12:55:49 +00:00
IsSeries = request . IsSeries ,
2015-04-03 16:31:56 +00:00
IsMovie = request . IsMovie ,
2015-08-04 14:26:36 +00:00
IsKids = request . IsKids ,
2016-09-29 12:55:49 +00:00
IsNews = request . IsNews ,
2016-05-09 03:13:38 +00:00
IsSports = request . IsSports ,
EnableTotalRecordCount = request . EnableTotalRecordCount
2014-01-12 15:58:47 +00:00
} ;
2017-10-03 18:39:37 +00:00
var result = _liveTvManager . GetRecommendedPrograms ( query , GetDtoOptions ( _authContext , request ) , CancellationToken . None ) ;
2014-01-12 15:58:47 +00:00
2015-04-09 05:20:23 +00:00
return ToOptimizedResult ( result ) ;
2013-11-02 21:38:21 +00:00
}
2013-11-26 02:53:48 +00:00
2014-01-10 13:52:01 +00:00
public object Post ( GetPrograms request )
{
return Get ( request ) ;
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetRecordings request )
2013-11-26 02:53:48 +00:00
{
2016-11-10 14:41:24 +00:00
var options = GetDtoOptions ( _authContext , request ) ;
options . DeviceId = _authContext . GetAuthorizationInfo ( Request ) . DeviceId ;
2015-04-12 18:58:21 +00:00
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetRecordings ( new RecordingQuery
2013-11-26 21:36:11 +00:00
{
2013-12-15 01:17:57 +00:00
ChannelId = request . ChannelId ,
2013-12-28 21:37:01 +00:00
UserId = request . UserId ,
2013-12-28 23:09:24 +00:00
GroupId = request . GroupId ,
StartIndex = request . StartIndex ,
2014-01-01 18:26:31 +00:00
Limit = request . Limit ,
2014-01-15 15:18:31 +00:00
Status = request . Status ,
SeriesTimerId = request . SeriesTimerId ,
2016-06-20 17:07:53 +00:00
IsInProgress = request . IsInProgress ,
2016-09-05 05:39:14 +00:00
EnableTotalRecordCount = request . EnableTotalRecordCount ,
IsMovie = request . IsMovie ,
2016-09-29 12:55:49 +00:00
IsNews = request . IsNews ,
2016-09-06 17:59:10 +00:00
IsSeries = request . IsSeries ,
IsKids = request . IsKids ,
2016-12-20 05:21:21 +00:00
IsSports = request . IsSports ,
IsLibraryItem = request . IsLibraryItem
2016-09-06 17:59:10 +00:00
} , options , CancellationToken . None ) . ConfigureAwait ( false ) ;
return ToOptimizedResult ( result ) ;
}
2017-08-28 00:33:05 +00:00
public object Get ( GetRecordingSeries request )
2016-09-06 17:59:10 +00:00
{
2016-11-10 14:41:24 +00:00
var options = GetDtoOptions ( _authContext , request ) ;
options . DeviceId = _authContext . GetAuthorizationInfo ( Request ) . DeviceId ;
2016-09-06 17:59:10 +00:00
2017-08-28 00:33:05 +00:00
var result = _liveTvManager . GetRecordingSeries ( new RecordingQuery
2016-09-06 17:59:10 +00:00
{
ChannelId = request . ChannelId ,
UserId = request . UserId ,
GroupId = request . GroupId ,
StartIndex = request . StartIndex ,
Limit = request . Limit ,
Status = request . Status ,
SeriesTimerId = request . SeriesTimerId ,
IsInProgress = request . IsInProgress ,
EnableTotalRecordCount = request . EnableTotalRecordCount
2013-11-26 21:36:11 +00:00
2017-08-28 00:33:05 +00:00
} , options , CancellationToken . None ) ;
2013-11-26 02:53:48 +00:00
2015-04-09 05:20:23 +00:00
return ToOptimizedResult ( result ) ;
2013-11-26 02:53:48 +00:00
}
2013-11-27 19:04:19 +00:00
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetRecording request )
2013-12-04 04:18:50 +00:00
{
2017-10-13 05:44:20 +00:00
var user = _userManager . GetUserById ( request . UserId ) ;
2013-12-15 01:17:57 +00:00
2017-10-13 05:44:20 +00:00
var item = string . IsNullOrEmpty ( request . Id ) ? user . RootFolder : _libraryManager . GetItemById ( request . Id ) ;
2015-04-12 18:58:21 +00:00
2017-10-13 05:44:20 +00:00
var dtoOptions = GetDtoOptions ( _authContext , request ) ;
var result = _dtoService . GetBaseItemDto ( item , dtoOptions , user ) ;
2013-12-04 04:18:50 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-04 04:18:50 +00:00
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetTimer request )
2013-12-04 04:18:50 +00:00
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetTimer ( request . Id , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-04 04:18:50 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-04 04:18:50 +00:00
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetTimers request )
2013-11-27 19:04:19 +00:00
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetTimers ( new TimerQuery
2013-11-27 19:04:19 +00:00
{
2014-01-08 05:25:21 +00:00
ChannelId = request . ChannelId ,
2016-06-19 17:41:49 +00:00
SeriesTimerId = request . SeriesTimerId ,
2016-10-04 05:15:39 +00:00
IsActive = request . IsActive ,
IsScheduled = request . IsScheduled
2013-11-27 19:04:19 +00:00
2014-08-17 05:38:13 +00:00
} , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-11-27 19:04:19 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-11-27 19:04:19 +00:00
}
2013-11-29 16:58:24 +00:00
public void Delete ( DeleteRecording request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-11-29 16:58:24 +00:00
var task = _liveTvManager . DeleteRecording ( request . Id ) ;
Task . WaitAll ( task ) ;
}
public void Delete ( CancelTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-11-29 16:58:24 +00:00
var task = _liveTvManager . CancelTimer ( request . Id ) ;
Task . WaitAll ( task ) ;
}
2013-12-15 01:17:57 +00:00
public void Post ( UpdateTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-12-15 01:17:57 +00:00
var task = _liveTvManager . UpdateTimer ( request , CancellationToken . None ) ;
Task . WaitAll ( task ) ;
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetSeriesTimers request )
2013-12-15 01:17:57 +00:00
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetSeriesTimers ( new SeriesTimerQuery
2013-12-17 20:02:12 +00:00
{
2014-01-11 23:07:56 +00:00
SortOrder = request . SortOrder ,
SortBy = request . SortBy
2013-12-15 01:17:57 +00:00
2014-08-17 05:38:13 +00:00
} , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-15 01:17:57 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-15 01:17:57 +00:00
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetSeriesTimer request )
2013-12-15 01:17:57 +00:00
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetSeriesTimer ( request . Id , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-15 01:17:57 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-15 01:17:57 +00:00
}
2013-12-15 14:19:24 +00:00
public void Delete ( CancelSeriesTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-12-15 14:19:24 +00:00
var task = _liveTvManager . CancelSeriesTimer ( request . Id ) ;
Task . WaitAll ( task ) ;
}
public void Post ( UpdateSeriesTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-12-15 14:19:24 +00:00
var task = _liveTvManager . UpdateSeriesTimer ( request , CancellationToken . None ) ;
Task . WaitAll ( task ) ;
}
2013-12-17 20:02:12 +00:00
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetDefaultTimer request )
2013-12-17 20:02:12 +00:00
{
2013-12-18 05:44:46 +00:00
if ( string . IsNullOrEmpty ( request . ProgramId ) )
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetNewTimerDefaults ( CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-17 20:02:12 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-18 05:44:46 +00:00
}
else
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetNewTimerDefaults ( request . ProgramId , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-18 05:44:46 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-18 05:44:46 +00:00
}
2013-12-17 20:02:12 +00:00
}
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetProgram request )
2013-12-17 20:02:12 +00:00
{
2014-09-14 15:10:51 +00:00
var user = string . IsNullOrEmpty ( request . UserId ) ? null : _userManager . GetUserById ( request . UserId ) ;
2013-12-17 20:02:12 +00:00
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetProgram ( request . Id , CancellationToken . None , user ) . ConfigureAwait ( false ) ;
2013-12-17 20:02:12 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-17 20:02:12 +00:00
}
public void Post ( CreateSeriesTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-12-17 20:02:12 +00:00
var task = _liveTvManager . CreateSeriesTimer ( request , CancellationToken . None ) ;
Task . WaitAll ( task ) ;
}
public void Post ( CreateTimer request )
{
2014-01-13 20:31:09 +00:00
AssertUserCanManageLiveTv ( ) ;
2013-12-17 20:02:12 +00:00
var task = _liveTvManager . CreateTimer ( request , CancellationToken . None ) ;
Task . WaitAll ( task ) ;
}
2013-12-22 18:58:51 +00:00
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetRecordingGroups request )
2013-12-28 21:37:01 +00:00
{
2014-08-17 05:38:13 +00:00
var result = await _liveTvManager . GetRecordingGroups ( new RecordingGroupQuery
2013-12-28 21:37:01 +00:00
{
UserId = request . UserId
2014-08-17 05:38:13 +00:00
} , CancellationToken . None ) . ConfigureAwait ( false ) ;
2013-12-28 21:37:01 +00:00
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( result ) ;
2013-12-28 21:37:01 +00:00
}
2014-01-02 03:53:27 +00:00
2014-08-17 05:38:13 +00:00
public async Task < object > Get ( GetRecordingGroup request )
2014-01-02 03:53:27 +00:00
{
2016-07-29 19:18:03 +00:00
var result = await _liveTvManager . GetRecordingGroups ( new RecordingGroupQuery ( ) , CancellationToken . None ) . ConfigureAwait ( false ) ;
2014-01-02 03:53:27 +00:00
var group = result . Items . FirstOrDefault ( i = > string . Equals ( i . Id , request . Id , StringComparison . OrdinalIgnoreCase ) ) ;
2014-02-04 04:04:19 +00:00
return ToOptimizedSerializedResultUsingCache ( group ) ;
2014-01-02 03:53:27 +00:00
}
2014-01-07 18:39:35 +00:00
public object Get ( GetGuideInfo request )
{
return ToOptimizedResult ( _liveTvManager . GetGuideInfo ( ) ) ;
}
2014-01-23 22:15:15 +00:00
public void Post ( ResetTuner request )
{
AssertUserCanManageLiveTv ( ) ;
var task = _liveTvManager . ResetTuner ( request . Id , CancellationToken . None ) ;
Task . WaitAll ( task ) ;
}
2013-09-26 15:48:14 +00:00
}
2013-11-02 21:38:21 +00:00
}