The Free Software Media System - Server Backend & API
display programs on channel page
Luke Pulverentia641059c571d
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.csindex 3863ef2094..55ee454d2e 100644--- a/MediaBrowser.Api/LibraryService.cs+++ b/MediaBrowser.Api/LibraryService.cs@@ -37,7 +37,7 @@ namespace MediaBrowser.Api/// </summary>[Route("/Items/{Id}/CriticReviews", "GET")][Api(Description = "Gets critic reviews for an item")]- public class GetCriticReviews : IReturn<ItemReviewsResult>+ public class GetCriticReviews : IReturn<QueryResult<ItemReview>>{/// <summary>/// Gets or sets the id.@@ -509,16 +509,16 @@ namespace MediaBrowser.Api/// </summary>/// <param name="request">The request.</param>/// <returns>Task{ItemReviewsResult}.</returns>- private ItemReviewsResult GetCriticReviews(GetCriticReviews request)+ private QueryResult<ItemReview> GetCriticReviews(GetCriticReviews request){var reviews = _itemRepo.GetCriticReviews(new Guid(request.Id));var reviewsArray = reviews.ToArray();- var result = new ItemReviewsResult- {- TotalRecordCount = reviewsArray.Length- };+ var result = new QueryResult<ItemReview>+ {+ TotalRecordCount = reviewsArray.Length+ };if (request.StartIndex.HasValue){@@ -529,7 +529,7 @@ namespace MediaBrowser.ApireviewsArray = reviewsArray.Take(request.Limit.Value).ToArray();}- result.ItemReviews = reviewsArray;+ result.Items = reviewsArray;return result;}diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.csindex b10d8d481e..5cd23a738f 100644--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs@@ -1,11 +1,10 @@-using System;-using MediaBrowser.Controller.LiveTv;+using MediaBrowser.Controller.LiveTv;using MediaBrowser.Model.LiveTv;+using MediaBrowser.Model.Querying;using ServiceStack.ServiceHost;+using System;using System.Collections.Generic;using System.Linq;-using System.Threading;-using System.Threading.Tasks;namespace MediaBrowser.Api.LiveTv{@@ -19,7 +18,7 @@ namespace MediaBrowser.Api.LiveTv[Route("/LiveTv/Channels", "GET")][Api(Description = "Gets available live tv channels.")]- public class GetChannels : IReturn<List<ChannelInfoDto>>+ public class GetChannels : IReturn<QueryResult<ChannelInfoDto>>{[ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string ServiceName { get; set; }@@ -43,22 +42,14 @@ namespace MediaBrowser.Api.LiveTvpublic string Id { get; set; }}- [Route("/LiveTv/Recordings", "GET")]- [Api(Description = "Gets available live tv recordings.")]- public class GetRecordings : IReturn<List<RecordingInfo>>- {- [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]- public string ServiceName { get; set; }- }-[Route("/LiveTv/Programs", "GET")][Api(Description = "Gets available live tv epgs..")]- public class GetPrograms : IReturn<List<ProgramInfo>>+ public class GetPrograms : IReturn<QueryResult<ProgramInfoDto>>{- [ApiMember(Name = "ServiceName", Description = "Live tv service name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]+ [ApiMember(Name = "ServiceName", Description = "Live tv service name", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string ServiceName { get; set; }- [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]+ [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string ChannelIds { get; set; }}@@ -108,10 +99,9 @@ namespace MediaBrowser.Api.LiveTvServiceName = request.ServiceName,UserId = request.UserId- })- .Select(_liveTvManager.GetChannelInfoDto);+ });- return ToOptimizedResult(result.ToList());+ return ToOptimizedResult(result);}public object Get(GetChannel request)@@ -121,29 +111,6 @@ namespace MediaBrowser.Api.LiveTvreturn ToOptimizedResult(_liveTvManager.GetChannelInfoDto(result));}- public object Get(GetRecordings request)- {- var result = GetRecordingsAsync(request).Result;-- return ToOptimizedResult(result.ToList());- }-- private async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(GetRecordings request)- {- var services = GetServices(request.ServiceName);-- var query = new RecordingQuery- {-- };-- var tasks = services.Select(i => i.GetRecordingsAsync(query, CancellationToken.None));-- var recordings = await Task.WhenAll(tasks).ConfigureAwait(false);-- return recordings.SelectMany(i => i);- }-public object Get(GetPrograms request){var result = _liveTvManager.GetPrograms(new ProgramQuery@@ -152,7 +119,7 @@ namespace MediaBrowser.Api.LiveTvChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray()});- return ToOptimizedResult(result.ToList());+ return ToOptimizedResult(result);}}}\ No newline at end of filediff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.csindex 339367c170..e7b5d733b9 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs@@ -1,4 +1,5 @@using MediaBrowser.Model.LiveTv;+using MediaBrowser.Model.Querying;using System.Collections.Generic;namespace MediaBrowser.Controller.LiveTv@@ -25,7 +26,7 @@ namespace MediaBrowser.Controller.LiveTv/// </summary>/// <param name="query">The query.</param>/// <returns>IEnumerable{Channel}.</returns>- IEnumerable<Channel> GetChannels(ChannelQuery query);+ QueryResult<ChannelInfoDto> GetChannels(ChannelQuery query);/// <summary>/// Gets the channel information dto.@@ -46,6 +47,6 @@ namespace MediaBrowser.Controller.LiveTv/// </summary>/// <param name="query">The query.</param>/// <returns>IEnumerable{ProgramInfo}.</returns>- IEnumerable<ProgramInfo> GetPrograms(ProgramQuery query);+ QueryResult<ProgramInfoDto> GetPrograms(ProgramQuery query);}}diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.csindex 53cb514b52..4e4f8dcc78 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs@@ -1,5 +1,4 @@using MediaBrowser.Common.Net;-using MediaBrowser.Model.LiveTv;using System;using System.Collections.Generic;using System.Threading;@@ -33,6 +32,14 @@ namespace MediaBrowser.Controller.LiveTv/// <returns>Task.</returns>Task CancelRecordingAsync(string recordingId, CancellationToken cancellationToken);+ /// <summary>+ /// Deletes the recording asynchronous.+ /// </summary>+ /// <param name="recordingId">The recording identifier.</param>+ /// <param name="cancellationToken">The cancellation token.</param>+ /// <returns>Task.</returns>+ Task DeleteRecordingAsync(string recordingId, CancellationToken cancellationToken);+/// <summary>/// Schedules the recording asynchronous./// </summary>@@ -42,8 +49,8 @@ namespace MediaBrowser.Controller.LiveTv/// <param name="duration">The duration.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task.</returns>- Task ScheduleRecordingAsync(string name,string channelId, DateTime startTime, TimeSpan duration, CancellationToken cancellationToken);-+ Task ScheduleRecordingAsync(string name, string channelId, DateTime startTime, TimeSpan duration, CancellationToken cancellationToken);+/// <summary>/// Gets the channel image asynchronous./// </summary>@@ -55,17 +62,16 @@ namespace MediaBrowser.Controller.LiveTv/// <summary>/// Gets the recordings asynchronous./// </summary>- /// <param name="query">The query.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{IEnumerable{RecordingInfo}}.</returns>- Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken);+ Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken);/// <summary>- /// Gets the channel guide.+ /// Gets the programs asynchronous./// </summary>/// <param name="channelId">The channel identifier.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{IEnumerable{ProgramInfo}}.</returns>- Task<IEnumerable<ProgramInfo>> GetChannelGuideAsync(string channelId, CancellationToken cancellationToken);+ Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, CancellationToken cancellationToken);}}diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.csnew file mode 100644index 0000000000..8314b91705--- /dev/null+++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs@@ -0,0 +1,49 @@+using System;+using System.Collections.Generic;++namespace MediaBrowser.Controller.LiveTv+{+ public class ProgramInfo+ {+ /// <summary>+ /// Id of the program.+ /// </summary>+ public string Id { get; set; }++ /// <summary>+ /// Gets or sets the channel identifier.+ /// </summary>+ /// <value>The channel identifier.</value>+ public string ChannelId { get; set; }++ /// <summary>+ /// Name of the program+ /// </summary>+ public string Name { get; set; }++ /// <summary>+ /// Description of the progam.+ /// </summary>+ public string Description { get; set; }++ /// <summary>+ /// The start date of the program, in UTC.+ /// </summary>+ public DateTime StartDate { get; set; }++ /// <summary>+ /// The end date of the program, in UTC.+ /// </summary>+ public DateTime EndDate { get; set; }++ /// <summary>+ /// Genre of the program.+ /// </summary>+ public List<string> Genres { get; set; }++ public ProgramInfo()+ {+ Genres = new List<string>();+ }+ }+}diff --git a/MediaBrowser.Model/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cssimilarity index 97%rename from MediaBrowser.Model/LiveTv/RecordingInfo.csrename to MediaBrowser.Controller/LiveTv/RecordingInfo.csindex 55a30a4b38..f35b6d5c63 100644--- a/MediaBrowser.Model/LiveTv/RecordingInfo.cs+++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs@@ -1,7 +1,7 @@using System;using System.Collections.Generic;-namespace MediaBrowser.Model.LiveTv+namespace MediaBrowser.Controller.LiveTv{public class RecordingInfo{@@ -75,4 +75,4 @@ namespace MediaBrowser.Model.LiveTv/// </summary>public List<string> DayMask { get; set; }}-}\ No newline at end of file+}diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csprojindex ea227349ea..ed63bc1647 100644--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj@@ -108,6 +108,8 @@<Compile Include="LiveTv\ChannelInfo.cs" /><Compile Include="LiveTv\ILiveTvManager.cs" /><Compile Include="LiveTv\ILiveTvService.cs" />+ <Compile Include="LiveTv\ProgramInfo.cs" />+ <Compile Include="LiveTv\RecordingInfo.cs" /><Compile Include="Localization\ILocalizationManager.cs" /><Compile Include="Notifications\INotificationsRepository.cs" /><Compile Include="Notifications\NotificationUpdateEventArgs.cs" />diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csprojindex 2850d09edc..e7003219a4 100644--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj@@ -236,14 +236,14 @@<Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs"><Link>LiveTv\LiveTvServiceInfo.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramInfo.cs">- <Link>LiveTv\ProgramInfo.cs</Link>+ <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramInfoDto.cs">+ <Link>LiveTv\ProgramInfoDto.cs</Link></Compile><Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs"><Link>LiveTv\ProgramQuery.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingInfo.cs">- <Link>LiveTv\RecordingInfo.cs</Link>+ <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingInfoDto.cs">+ <Link>LiveTv\RecordingInfoDto.cs</Link></Compile><Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs"><Link>LiveTv\RecordingQuery.cs</Link>@@ -329,9 +329,6 @@<Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs"><Link>Querying\ItemQuery.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\Querying\ItemReviewsResult.cs">- <Link>Querying\ItemReviewsResult.cs</Link>- </Compile><Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs"><Link>Querying\ItemsByNameQuery.cs</Link></Compile>@@ -347,6 +344,9 @@<Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs"><Link>Querying\PersonsQuery.cs</Link></Compile>+ <Compile Include="..\MediaBrowser.Model\Querying\QueryResult.cs">+ <Link>Querying\QueryResult.cs</Link>+ </Compile><Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs"><Link>Querying\SessionQuery.cs</Link></Compile>diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csprojindex be62681840..f0d23c959b 100644--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj@@ -223,14 +223,14 @@<Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs"><Link>LiveTv\LiveTvServiceInfo.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramInfo.cs">- <Link>LiveTv\ProgramInfo.cs</Link>+ <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramInfoDto.cs">+ <Link>LiveTv\ProgramInfoDto.cs</Link></Compile><Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs"><Link>LiveTv\ProgramQuery.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingInfo.cs">- <Link>LiveTv\RecordingInfo.cs</Link>+ <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingInfoDto.cs">+ <Link>LiveTv\RecordingInfoDto.cs</Link></Compile><Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs"><Link>LiveTv\RecordingQuery.cs</Link>@@ -316,9 +316,6 @@<Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs"><Link>Querying\ItemQuery.cs</Link></Compile>- <Compile Include="..\MediaBrowser.Model\Querying\ItemReviewsResult.cs">- <Link>Querying\ItemReviewsResult.cs</Link>- </Compile><Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs"><Link>Querying\ItemsByNameQuery.cs</Link></Compile>@@ -334,6 +331,9 @@<Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs"><Link>Querying\PersonsQuery.cs</Link></Compile>+ <Compile Include="..\MediaBrowser.Model\Querying\QueryResult.cs">+ <Link>Querying\QueryResult.cs</Link>+ </Compile><Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs"><Link>Querying\SessionQuery.cs</Link></Compile>diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.csindex 7817a26cd3..ad82966048 100644--- a/MediaBrowser.Model/ApiClient/IApiClient.cs+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs@@ -83,7 +83,7 @@ namespace MediaBrowser.Model.ApiClient/// <param name="startIndex">The start index.</param>/// <param name="limit">The limit.</param>/// <returns>Task{ItemReviewsResult}.</returns>- Task<ItemReviewsResult> GetCriticReviews(string itemId, CancellationToken cancellationToken, int? startIndex = null, int? limit = null);+ Task<QueryResult<ItemReview>> GetCriticReviews(string itemId, CancellationToken cancellationToken, int? startIndex = null, int? limit = null);/// <summary>/// Gets the theme songs async.diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.csindex fe242b66cd..c8d351bd05 100644--- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs@@ -18,12 +18,6 @@ namespace MediaBrowser.Model.LiveTv/// </summary>/// <value>The identifier.</value>public string Id { get; set; }-- /// <summary>- /// Gets or sets the channel identifier.- /// </summary>- /// <value>The channel identifier.</value>- public string ChannelId { get; set; }/// <summary>/// Gets or sets the logo image tag.diff --git a/MediaBrowser.Model/LiveTv/ProgramInfo.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cssimilarity index 69%rename from MediaBrowser.Model/LiveTv/ProgramInfo.csrename to MediaBrowser.Model/LiveTv/ProgramInfoDto.csindex 75ec5df705..15387d5204 100644--- a/MediaBrowser.Model/LiveTv/ProgramInfo.cs+++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs@@ -1,14 +1,21 @@using System;+using System.Collections.Generic;namespace MediaBrowser.Model.LiveTv{- public class ProgramInfo+ public class ProgramInfoDto{/// <summary>/// Id of the program./// </summary>public string Id { get; set; }+ /// <summary>+ /// Gets or sets the external identifier.+ /// </summary>+ /// <value>The external identifier.</value>+ public string ExternalId { get; set; }+/// <summary>/// Gets or sets the channel identifier./// </summary>@@ -16,17 +23,17 @@ namespace MediaBrowser.Model.LiveTvpublic string ChannelId { get; set; }/// <summary>- /// Gets or sets the name of the service.+ /// Gets or sets the recording identifier./// </summary>- /// <value>The name of the service.</value>- public string ServiceName { get; set; }+ /// <value>The recording identifier.</value>+ public string RecordingId { get; set; }/// <summary>- /// Gets or sets the external channel identifier.+ /// Gets or sets the name of the service./// </summary>- /// <value>The external channel identifier.</value>- public string ExternalChannelId { get; set; }-+ /// <value>The name of the service.</value>+ public string ServiceName { get; set; }+/// <summary>/// Name of the program/// </summary>@@ -50,6 +57,11 @@ namespace MediaBrowser.Model.LiveTv/// <summary>/// Genre of the program./// </summary>- public string Genre { get; set; }+ public List<string> Genres { get; set; }++ public ProgramInfoDto()+ {+ Genres = new List<string>();+ }}}\ No newline at end of filediff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.csnew file mode 100644index 0000000000..b24af04a03--- /dev/null+++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs@@ -0,0 +1,78 @@+using System;+using System.Collections.Generic;++namespace MediaBrowser.Model.LiveTv+{+ public class RecordingInfoDto+ {+ /// <summary>+ /// Id of the recording.+ /// </summary>+ public string Id { get; set; }++ /// <summary>+ /// ChannelId of the recording.+ /// </summary>+ public string ChannelId { get; set; }++ /// <summary>+ /// ChannelName of the recording.+ /// </summary>+ public string ChannelName { get; set; }++ /// <summary>+ /// Name of the recording.+ /// </summary>+ public string Name { get; set; }++ /// <summary>+ /// Description of the recording.+ /// </summary>+ public string Description { get; set; }++ /// <summary>+ /// The start date of the recording, in UTC.+ /// </summary>+ public DateTime StartDate { get; set; }++ /// <summary>+ /// The end date of the recording, in UTC.+ /// </summary>+ public DateTime EndDate { get; set; }++ /// <summary>+ /// Status of the recording.+ /// </summary>+ public string Status { get; set; } //TODO: Enum for status?? Difference NextPvr,Argus,...++ /// <summary>+ /// Quality of the Recording.+ /// </summary>+ public string Quality { get; set; } // TODO: Enum for quality?? Difference NextPvr,Argus,...++ /// <summary>+ /// Recurring recording?+ /// </summary>+ public bool Recurring { get; set; }++ /// <summary>+ /// Parent recurring.+ /// </summary>+ public string RecurringParent { get; set; }++ /// <summary>+ /// Start date for the recurring, in UTC.+ /// </summary>+ public DateTime RecurrringStartDate { get; set; }++ /// <summary>+ /// End date for the recurring, in UTC+ /// </summary>+ public DateTime RecurringEndDate { get; set; }++ /// <summary>+ /// When do we need the recording?+ /// </summary>+ public List<string> DayMask { get; set; }+ }+}\ No newline at end of filediff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.csindex e7a91f4d55..8d9866b5ec 100644--- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs+++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs@@ -5,10 +5,6 @@/// </summary>public class RecordingQuery{- /// <summary>- /// Gets or sets a value indicating whether this instance has recorded.- /// </summary>- /// <value><c>null</c> if [has recorded] contains no value, <c>true</c> if [has recorded]; otherwise, <c>false</c>.</value>- public bool? HasRecorded { get; set; }+ public string ChannelId { get; set; }}}diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csprojindex 05b4e9b7a0..1e94c6b5fb 100644--- a/MediaBrowser.Model/MediaBrowser.Model.csproj+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj@@ -62,7 +62,7 @@<Compile Include="Entities\PackageReviewInfo.cs" /><Compile Include="LiveTv\ChannelInfoDto.cs" /><Compile Include="LiveTv\ChannelQuery.cs" />- <Compile Include="LiveTv\ProgramInfo.cs" />+ <Compile Include="LiveTv\ProgramInfoDto.cs" /><Compile Include="LiveTv\ProgramQuery.cs" /><Compile Include="LiveTv\RecordingQuery.cs" /><Compile Include="Providers\ImageProviderInfo.cs" />@@ -80,7 +80,7 @@<Compile Include="IO\IIsoMounter.cs" /><Compile Include="LiveTv\ChannelType.cs" /><Compile Include="LiveTv\LiveTvServiceInfo.cs" />- <Compile Include="LiveTv\RecordingInfo.cs" />+ <Compile Include="LiveTv\RecordingInfoDto.cs" /><Compile Include="Net\WebSocketMessage.cs" /><Compile Include="Net\WebSocketMessageType.cs" /><Compile Include="Net\WebSocketState.cs" />@@ -93,10 +93,10 @@<Compile Include="Querying\ArtistsQuery.cs" /><Compile Include="Querying\EpisodeQuery.cs" /><Compile Include="Querying\ItemCountsQuery.cs" />- <Compile Include="Querying\ItemReviewsResult.cs" /><Compile Include="Querying\ItemsByNameQuery.cs" /><Compile Include="Entities\BaseItemInfo.cs" /><Compile Include="Querying\NextUpQuery.cs" />+ <Compile Include="Querying\QueryResult.cs" /><Compile Include="Querying\SessionQuery.cs" /><Compile Include="Querying\SimilarItemsQuery.cs" /><Compile Include="Querying\UserQuery.cs" />diff --git a/MediaBrowser.Model/Querying/ItemReviewsResult.cs b/MediaBrowser.Model/Querying/QueryResult.cssimilarity index 53%rename from MediaBrowser.Model/Querying/ItemReviewsResult.csrename to MediaBrowser.Model/Querying/QueryResult.csindex 6a29827a91..1ecc1de6c4 100644--- a/MediaBrowser.Model/Querying/ItemReviewsResult.cs+++ b/MediaBrowser.Model/Querying/QueryResult.cs@@ -1,17 +1,13 @@-using MediaBrowser.Model.Entities;-+namespace MediaBrowser.Model.Querying{- /// <summary>- /// Class ItemReviewsResult- /// </summary>- public class ItemReviewsResult+ public class QueryResult<T>{/// <summary>- /// Gets or sets the item reviews.+ /// Gets or sets the items./// </summary>- /// <value>The item reviews.</value>- public ItemReview[] ItemReviews { get; set; }+ /// <value>The items.</value>+ public T[] Items { get; set; }/// <summary>/// The total number of records available@@ -22,9 +18,9 @@ namespace MediaBrowser.Model.Querying/// <summary>/// Initializes a new instance of the <see cref="ItemsResult" /> class./// </summary>- public ItemReviewsResult()+ public QueryResult(){- ItemReviews = new ItemReview[] { };+ Items = new T[] { };}- }+ }}diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.csindex 825c7d8ef8..fe58f292ca 100644--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs@@ -13,6 +13,7 @@ using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;+using MediaBrowser.Model.Querying;namespace MediaBrowser.Server.Implementations.LiveTv{@@ -27,12 +28,11 @@ namespace MediaBrowser.Server.Implementations.LiveTvprivate readonly IItemRepository _itemRepo;private readonly IImageProcessor _imageProcessor;- private List<Channel> _channels = new List<Channel>();-- private Dictionary<Guid, List<ProgramInfo>> _guide = new Dictionary<Guid, List<ProgramInfo>>();-private readonly List<ILiveTvService> _services = new List<ILiveTvService>();+ private List<Channel> _channels = new List<Channel>();+ private List<ProgramInfoDto> _programs = new List<ProgramInfoDto>();+public LiveTvManager(IServerApplicationPaths appPaths, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor){_appPaths = appPaths;@@ -72,7 +72,6 @@ namespace MediaBrowser.Server.Implementations.LiveTvName = info.Name,ServiceName = info.ServiceName,ChannelType = info.ChannelType,- ChannelId = info.ChannelId,Number = info.ChannelNumber,PrimaryImageTag = GetLogoImageTag(info),Type = info.GetType().Name,@@ -107,9 +106,9 @@ namespace MediaBrowser.Server.Implementations.LiveTvreturn null;}- public IEnumerable<Channel> GetChannels(ChannelQuery query)+ public QueryResult<ChannelInfoDto> GetChannels(ChannelQuery query){- return _channels.OrderBy(i =>+ var channels = _channels.OrderBy(i =>{double number = 0;@@ -120,7 +119,15 @@ namespace MediaBrowser.Server.Implementations.LiveTvreturn number;- }).ThenBy(i => i.Name);+ }).ThenBy(i => i.Name)+ .Select(GetChannelInfoDto)+ .ToArray();++ return new QueryResult<ChannelInfoDto>+ {+ Items = channels,+ TotalRecordCount = channels.Length+ };}public Channel GetChannel(string id)@@ -135,16 +142,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv// Avoid implicitly captured closurevar currentCancellationToken = cancellationToken;- var tasks = _services.Select(i => i.GetChannelsAsync(currentCancellationToken));+ var channelTasks = _services.Select(i => i.GetChannelsAsync(currentCancellationToken));progress.Report(10);- var results = await Task.WhenAll(tasks).ConfigureAwait(false);+ var results = await Task.WhenAll(channelTasks).ConfigureAwait(false);var allChannels = results.SelectMany(i => i).ToList();var list = new List<Channel>();- var guide = new Dictionary<Guid, List<ProgramInfo>>();+ var programs = new List<ProgramInfoDto>();var numComplete = 0;@@ -156,18 +163,11 @@ namespace MediaBrowser.Server.Implementations.LiveTvvar service = GetService(channelInfo);- var programs = await service.GetChannelGuideAsync(channelInfo.Id, cancellationToken).ConfigureAwait(false);- var programList = programs.ToList();+ var channelPrograms = await service.GetProgramsAsync(channelInfo.Id, cancellationToken).ConfigureAwait(false);- foreach (var program in programList)- {- program.ExternalChannelId = channelInfo.Id;- program.ChannelId = item.Id.ToString("N");- program.ServiceName = service.Name;- }+ programs.AddRange(channelPrograms.Select(program => GetProgramInfoDto(program, item)));list.Add(item);- guide[item.Id] = programList;}catch (OperationCanceledException){@@ -185,10 +185,29 @@ namespace MediaBrowser.Server.Implementations.LiveTvprogress.Report(90 * percent + 10);}- _guide = guide;+ _programs = programs;_channels = list;}+ private ProgramInfoDto GetProgramInfoDto(ProgramInfo program, Channel channel)+ {+ var id = channel.ServiceName + channel.ChannelId + program.Id;+ id = id.GetMD5().ToString("N");++ return new ProgramInfoDto+ {+ ChannelId = channel.Id.ToString("N"),+ Description = program.Description,+ EndDate = program.EndDate,+ Genres = program.Genres,+ ExternalId = program.Id,+ Id = id,+ Name = program.Name,+ ServiceName = channel.ServiceName,+ StartDate = program.StartDate+ };+ }+private async Task<Channel> GetChannel(ChannelInfo channelInfo, CancellationToken cancellationToken){var path = Path.Combine(_appPaths.ItemsByNamePath, "channels", _fileSystem.GetValidFilename(channelInfo.ServiceName), _fileSystem.GetValidFilename(channelInfo.Name));@@ -241,9 +260,11 @@ namespace MediaBrowser.Server.Implementations.LiveTvreturn item;}- public IEnumerable<ProgramInfo> GetPrograms(ProgramQuery query)+ public QueryResult<ProgramInfoDto> GetPrograms(ProgramQuery query){- var programs = _guide.Values.SelectMany(i => i);+ IEnumerable<ProgramInfoDto> programs = _programs+ .OrderBy(i => i.StartDate)+ .ThenBy(i => i.EndDate);if (!string.IsNullOrEmpty(query.ServiceName)){@@ -255,9 +276,15 @@ namespace MediaBrowser.Server.Implementations.LiveTvvar guids = query.ChannelIdList.Select(i => new Guid(i)).ToList();programs = programs.Where(i => guids.Contains(new Guid(i.ChannelId)));- }-- return programs;+ }++ var returnArray = programs.ToArray();++ return new QueryResult<ProgramInfoDto>+ {+ Items = returnArray,+ TotalRecordCount = returnArray.Length+ };}}}diff --git a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs b/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.csindex 64bf5cdd3f..c3803d9bbc 100644--- a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs@@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTvnew SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},- new IntervalTrigger{ Interval = TimeSpan.FromHours(4)}+ new IntervalTrigger{ Interval = TimeSpan.FromHours(2)}};}}diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.jsindex f2c0987236..e63eb4d2b1 100644--- a/MediaBrowser.WebDashboard/ApiClient.js+++ b/MediaBrowser.WebDashboard/ApiClient.js@@ -415,6 +415,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi});};+ self.getLiveTvPrograms = function (options) {++ var url = self.getUrl("/LiveTv/Programs", options || {});++ return self.ajax({+ type: "GET",+ url: url,+ dataType: "json"+ });+ };+self.getLiveTvRecordings = function (options) {var url = self.getUrl("/LiveTv/Recordings", options || {});diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.configindex 75cba28646..ab57a48b15 100644--- a/MediaBrowser.WebDashboard/packages.config+++ b/MediaBrowser.WebDashboard/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="MediaBrowser.ApiClient.Javascript" version="3.0.198" targetFramework="net45" />+ <package id="MediaBrowser.ApiClient.Javascript" version="3.0.199" targetFramework="net45" /><package id="ServiceStack.Common" version="3.9.62" targetFramework="net45" /><package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" /></packages>\ No newline at end of filediff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex ea21fc39b4..5a32ce2dd7 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.247</version>+ <version>3.0.248</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.247" />+ <dependency id="MediaBrowser.Common" version="3.0.248" /><dependency id="NLog" version="2.1.0" /><dependency id="ServiceStack.Text" version="3.9.58" /><dependency id="SimpleInjector" version="2.3.6" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex 1f2d32b5f1..e363cf621e 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.247</version>+ <version>3.0.248</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex 809cad71a2..83861329ba 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.247</version>+ <version>3.0.248</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.247" />+ <dependency id="MediaBrowser.Common" version="3.0.248" /></dependencies></metadata><files>