浏览代码

display programs on channel page

Luke Pulverenti 11 年之前
父节点
当前提交
a641059c57

+ 7 - 7
MediaBrowser.Api/LibraryService.cs

@@ -37,7 +37,7 @@ namespace MediaBrowser.Api
     /// </summary>
     /// </summary>
     [Route("/Items/{Id}/CriticReviews", "GET")]
     [Route("/Items/{Id}/CriticReviews", "GET")]
     [Api(Description = "Gets critic reviews for an item")]
     [Api(Description = "Gets critic reviews for an item")]
-    public class GetCriticReviews : IReturn<ItemReviewsResult>
+    public class GetCriticReviews : IReturn<QueryResult<ItemReview>>
     {
     {
         /// <summary>
         /// <summary>
         /// Gets or sets the id.
         /// Gets or sets the id.
@@ -509,16 +509,16 @@ namespace MediaBrowser.Api
         /// </summary>
         /// </summary>
         /// <param name="request">The request.</param>
         /// <param name="request">The request.</param>
         /// <returns>Task{ItemReviewsResult}.</returns>
         /// <returns>Task{ItemReviewsResult}.</returns>
-        private ItemReviewsResult GetCriticReviews(GetCriticReviews request)
+        private QueryResult<ItemReview> GetCriticReviews(GetCriticReviews request)
         {
         {
             var reviews = _itemRepo.GetCriticReviews(new Guid(request.Id));
             var reviews = _itemRepo.GetCriticReviews(new Guid(request.Id));
 
 
             var reviewsArray = reviews.ToArray();
             var reviewsArray = reviews.ToArray();
 
 
-            var result = new ItemReviewsResult
-                {
-                    TotalRecordCount = reviewsArray.Length
-                };
+            var result = new QueryResult<ItemReview>
+            {
+                TotalRecordCount = reviewsArray.Length
+            };
 
 
             if (request.StartIndex.HasValue)
             if (request.StartIndex.HasValue)
             {
             {
@@ -529,7 +529,7 @@ namespace MediaBrowser.Api
                 reviewsArray = reviewsArray.Take(request.Limit.Value).ToArray();
                 reviewsArray = reviewsArray.Take(request.Limit.Value).ToArray();
             }
             }
 
 
-            result.ItemReviews = reviewsArray;
+            result.Items = reviewsArray;
 
 
             return result;
             return result;
         }
         }

+ 10 - 43
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.LiveTv;
+using MediaBrowser.Model.Querying;
 using ServiceStack.ServiceHost;
 using ServiceStack.ServiceHost;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
 
 
 namespace MediaBrowser.Api.LiveTv
 namespace MediaBrowser.Api.LiveTv
 {
 {
@@ -19,7 +18,7 @@ namespace MediaBrowser.Api.LiveTv
 
 
     [Route("/LiveTv/Channels", "GET")]
     [Route("/LiveTv/Channels", "GET")]
     [Api(Description = "Gets available live tv channels.")]
     [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")]
         [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
         public string ServiceName { get; set; }
         public string ServiceName { get; set; }
@@ -43,22 +42,14 @@ namespace MediaBrowser.Api.LiveTv
         public string Id { get; set; }
         public 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")]
     [Route("/LiveTv/Programs", "GET")]
     [Api(Description = "Gets available live tv epgs..")]
     [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; }
         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; }
         public string ChannelIds { get; set; }
     }
     }
 
 
@@ -108,10 +99,9 @@ namespace MediaBrowser.Api.LiveTv
                 ServiceName = request.ServiceName,
                 ServiceName = request.ServiceName,
                 UserId = request.UserId
                 UserId = request.UserId
 
 
-            })
-            .Select(_liveTvManager.GetChannelInfoDto);
+            });
 
 
-            return ToOptimizedResult(result.ToList());
+            return ToOptimizedResult(result);
         }
         }
 
 
         public object Get(GetChannel request)
         public object Get(GetChannel request)
@@ -121,29 +111,6 @@ namespace MediaBrowser.Api.LiveTv
             return ToOptimizedResult(_liveTvManager.GetChannelInfoDto(result));
             return 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)
         public object Get(GetPrograms request)
         {
         {
             var result = _liveTvManager.GetPrograms(new ProgramQuery
             var result = _liveTvManager.GetPrograms(new ProgramQuery
@@ -152,7 +119,7 @@ namespace MediaBrowser.Api.LiveTv
                 ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray()
                 ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray()
             });
             });
 
 
-            return ToOptimizedResult(result.ToList());
+            return ToOptimizedResult(result);
         }
         }
     }
     }
 }
 }

+ 3 - 2
MediaBrowser.Controller/LiveTv/ILiveTvManager.cs

@@ -1,4 +1,5 @@
 using MediaBrowser.Model.LiveTv;
 using MediaBrowser.Model.LiveTv;
+using MediaBrowser.Model.Querying;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace MediaBrowser.Controller.LiveTv
 namespace MediaBrowser.Controller.LiveTv
@@ -25,7 +26,7 @@ namespace MediaBrowser.Controller.LiveTv
         /// </summary>
         /// </summary>
         /// <param name="query">The query.</param>
         /// <param name="query">The query.</param>
         /// <returns>IEnumerable{Channel}.</returns>
         /// <returns>IEnumerable{Channel}.</returns>
-        IEnumerable<Channel> GetChannels(ChannelQuery query);
+        QueryResult<ChannelInfoDto> GetChannels(ChannelQuery query);
 
 
         /// <summary>
         /// <summary>
         /// Gets the channel information dto.
         /// Gets the channel information dto.
@@ -46,6 +47,6 @@ namespace MediaBrowser.Controller.LiveTv
         /// </summary>
         /// </summary>
         /// <param name="query">The query.</param>
         /// <param name="query">The query.</param>
         /// <returns>IEnumerable{ProgramInfo}.</returns>
         /// <returns>IEnumerable{ProgramInfo}.</returns>
-        IEnumerable<ProgramInfo> GetPrograms(ProgramQuery query);
+        QueryResult<ProgramInfoDto> GetPrograms(ProgramQuery query);
     }
     }
 }
 }

+ 13 - 7
MediaBrowser.Controller/LiveTv/ILiveTvService.cs

@@ -1,5 +1,4 @@
 using MediaBrowser.Common.Net;
 using MediaBrowser.Common.Net;
-using MediaBrowser.Model.LiveTv;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Threading;
 using System.Threading;
@@ -33,6 +32,14 @@ namespace MediaBrowser.Controller.LiveTv
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         Task CancelRecordingAsync(string recordingId, CancellationToken cancellationToken);
         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>
         /// <summary>
         /// Schedules the recording asynchronous.
         /// Schedules the recording asynchronous.
         /// </summary>
         /// </summary>
@@ -42,8 +49,8 @@ namespace MediaBrowser.Controller.LiveTv
         /// <param name="duration">The duration.</param>
         /// <param name="duration">The duration.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task.</returns>
         /// <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>
         /// <summary>
         /// Gets the channel image asynchronous.
         /// Gets the channel image asynchronous.
         /// </summary>
         /// </summary>
@@ -55,17 +62,16 @@ namespace MediaBrowser.Controller.LiveTv
         /// <summary>
         /// <summary>
         /// Gets the recordings asynchronous.
         /// Gets the recordings asynchronous.
         /// </summary>
         /// </summary>
-        /// <param name="query">The query.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{IEnumerable{RecordingInfo}}.</returns>
         /// <returns>Task{IEnumerable{RecordingInfo}}.</returns>
-        Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken);
+        Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken);
 
 
         /// <summary>
         /// <summary>
-        /// Gets the channel guide.
+        /// Gets the programs asynchronous.
         /// </summary>
         /// </summary>
         /// <param name="channelId">The channel identifier.</param>
         /// <param name="channelId">The channel identifier.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{IEnumerable{ProgramInfo}}.</returns>
         /// <returns>Task{IEnumerable{ProgramInfo}}.</returns>
-        Task<IEnumerable<ProgramInfo>> GetChannelGuideAsync(string channelId, CancellationToken cancellationToken);
+        Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, CancellationToken cancellationToken);
     }
     }
 }
 }

+ 49 - 0
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>();
+        }
+    }
+}

+ 2 - 2
MediaBrowser.Model/LiveTv/RecordingInfo.cs → MediaBrowser.Controller/LiveTv/RecordingInfo.cs

@@ -1,7 +1,7 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
-namespace MediaBrowser.Model.LiveTv
+namespace MediaBrowser.Controller.LiveTv
 {
 {
     public class RecordingInfo
     public class RecordingInfo
     {
     {
@@ -75,4 +75,4 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         public List<string> DayMask { get; set; }
         public List<string> DayMask { get; set; }
     }
     }
-}
+}

+ 2 - 0
MediaBrowser.Controller/MediaBrowser.Controller.csproj

@@ -108,6 +108,8 @@
     <Compile Include="LiveTv\ChannelInfo.cs" />
     <Compile Include="LiveTv\ChannelInfo.cs" />
     <Compile Include="LiveTv\ILiveTvManager.cs" />
     <Compile Include="LiveTv\ILiveTvManager.cs" />
     <Compile Include="LiveTv\ILiveTvService.cs" />
     <Compile Include="LiveTv\ILiveTvService.cs" />
+    <Compile Include="LiveTv\ProgramInfo.cs" />
+    <Compile Include="LiveTv\RecordingInfo.cs" />
     <Compile Include="Localization\ILocalizationManager.cs" />
     <Compile Include="Localization\ILocalizationManager.cs" />
     <Compile Include="Notifications\INotificationsRepository.cs" />
     <Compile Include="Notifications\INotificationsRepository.cs" />
     <Compile Include="Notifications\NotificationUpdateEventArgs.cs" />
     <Compile Include="Notifications\NotificationUpdateEventArgs.cs" />

+ 7 - 7
MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj

@@ -236,14 +236,14 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>
     </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>
     <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs">
       <Link>LiveTv\ProgramQuery.cs</Link>
       <Link>LiveTv\ProgramQuery.cs</Link>
     </Compile>
     </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>
     <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs">
       <Link>LiveTv\RecordingQuery.cs</Link>
       <Link>LiveTv\RecordingQuery.cs</Link>
@@ -329,9 +329,6 @@
     <Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs">
       <Link>Querying\ItemQuery.cs</Link>
       <Link>Querying\ItemQuery.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Querying\ItemReviewsResult.cs">
-      <Link>Querying\ItemReviewsResult.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs">
       <Link>Querying\ItemsByNameQuery.cs</Link>
       <Link>Querying\ItemsByNameQuery.cs</Link>
     </Compile>
     </Compile>
@@ -347,6 +344,9 @@
     <Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs">
       <Link>Querying\PersonsQuery.cs</Link>
       <Link>Querying\PersonsQuery.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\Querying\QueryResult.cs">
+      <Link>Querying\QueryResult.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs">
       <Link>Querying\SessionQuery.cs</Link>
       <Link>Querying\SessionQuery.cs</Link>
     </Compile>
     </Compile>

+ 7 - 7
MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

@@ -223,14 +223,14 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>
     </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>
     <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\ProgramQuery.cs">
       <Link>LiveTv\ProgramQuery.cs</Link>
       <Link>LiveTv\ProgramQuery.cs</Link>
     </Compile>
     </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>
     <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\RecordingQuery.cs">
       <Link>LiveTv\RecordingQuery.cs</Link>
       <Link>LiveTv\RecordingQuery.cs</Link>
@@ -316,9 +316,6 @@
     <Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\ItemQuery.cs">
       <Link>Querying\ItemQuery.cs</Link>
       <Link>Querying\ItemQuery.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\MediaBrowser.Model\Querying\ItemReviewsResult.cs">
-      <Link>Querying\ItemReviewsResult.cs</Link>
-    </Compile>
     <Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\ItemsByNameQuery.cs">
       <Link>Querying\ItemsByNameQuery.cs</Link>
       <Link>Querying\ItemsByNameQuery.cs</Link>
     </Compile>
     </Compile>
@@ -334,6 +331,9 @@
     <Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\PersonsQuery.cs">
       <Link>Querying\PersonsQuery.cs</Link>
       <Link>Querying\PersonsQuery.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\Querying\QueryResult.cs">
+      <Link>Querying\QueryResult.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs">
     <Compile Include="..\MediaBrowser.Model\Querying\SessionQuery.cs">
       <Link>Querying\SessionQuery.cs</Link>
       <Link>Querying\SessionQuery.cs</Link>
     </Compile>
     </Compile>

+ 1 - 1
MediaBrowser.Model/ApiClient/IApiClient.cs

@@ -83,7 +83,7 @@ namespace MediaBrowser.Model.ApiClient
         /// <param name="startIndex">The start index.</param>
         /// <param name="startIndex">The start index.</param>
         /// <param name="limit">The limit.</param>
         /// <param name="limit">The limit.</param>
         /// <returns>Task{ItemReviewsResult}.</returns>
         /// <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>
         /// <summary>
         /// Gets the theme songs async.
         /// Gets the theme songs async.

+ 0 - 6
MediaBrowser.Model/LiveTv/ChannelInfoDto.cs

@@ -18,12 +18,6 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         /// <value>The identifier.</value>
         /// <value>The identifier.</value>
         public string Id { get; set; }
         public string Id { get; set; }
-
-        /// <summary>
-        /// Gets or sets the channel identifier.
-        /// </summary>
-        /// <value>The channel identifier.</value>
-        public string ChannelId { get; set; }
         
         
         /// <summary>
         /// <summary>
         /// Gets or sets the logo image tag.
         /// Gets or sets the logo image tag.

+ 21 - 9
MediaBrowser.Model/LiveTv/ProgramInfo.cs → MediaBrowser.Model/LiveTv/ProgramInfoDto.cs

@@ -1,14 +1,21 @@
 using System;
 using System;
+using System.Collections.Generic;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
-    public class ProgramInfo
+    public class ProgramInfoDto
     {
     {
         /// <summary>
         /// <summary>
         /// Id of the program.
         /// Id of the program.
         /// </summary>
         /// </summary>
         public string Id { get; set; }
         public string Id { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets the external identifier.
+        /// </summary>
+        /// <value>The external identifier.</value>
+        public string ExternalId { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets or sets the channel identifier.
         /// Gets or sets the channel identifier.
         /// </summary>
         /// </summary>
@@ -16,17 +23,17 @@ namespace MediaBrowser.Model.LiveTv
         public string ChannelId { get; set; }
         public string ChannelId { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets or sets the name of the service.
+        /// Gets or sets the recording identifier.
         /// </summary>
         /// </summary>
-        /// <value>The name of the service.</value>
-        public string ServiceName { get; set; }
+        /// <value>The recording identifier.</value>
+        public string RecordingId { get; set; }
         
         
         /// <summary>
         /// <summary>
-        /// Gets or sets the external channel identifier.
+        /// Gets or sets the name of the service.
         /// </summary>
         /// </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>
         /// <summary>
         /// Name of the program
         /// Name of the program
         /// </summary>
         /// </summary>
@@ -50,6 +57,11 @@ namespace MediaBrowser.Model.LiveTv
         /// <summary>
         /// <summary>
         /// Genre of the program.
         /// Genre of the program.
         /// </summary>
         /// </summary>
-        public string Genre { get; set; }
+        public List<string> Genres { get; set; }
+
+        public ProgramInfoDto()
+        {
+            Genres = new List<string>();
+        }
     }
     }
 }
 }

+ 78 - 0
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; }
+    }
+}

+ 1 - 5
MediaBrowser.Model/LiveTv/RecordingQuery.cs

@@ -5,10 +5,6 @@
     /// </summary>
     /// </summary>
     public class RecordingQuery
     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; }
     }
     }
 }
 }

+ 3 - 3
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -62,7 +62,7 @@
     <Compile Include="Entities\PackageReviewInfo.cs" />
     <Compile Include="Entities\PackageReviewInfo.cs" />
     <Compile Include="LiveTv\ChannelInfoDto.cs" />
     <Compile Include="LiveTv\ChannelInfoDto.cs" />
     <Compile Include="LiveTv\ChannelQuery.cs" />
     <Compile Include="LiveTv\ChannelQuery.cs" />
-    <Compile Include="LiveTv\ProgramInfo.cs" />
+    <Compile Include="LiveTv\ProgramInfoDto.cs" />
     <Compile Include="LiveTv\ProgramQuery.cs" />
     <Compile Include="LiveTv\ProgramQuery.cs" />
     <Compile Include="LiveTv\RecordingQuery.cs" />
     <Compile Include="LiveTv\RecordingQuery.cs" />
     <Compile Include="Providers\ImageProviderInfo.cs" />
     <Compile Include="Providers\ImageProviderInfo.cs" />
@@ -80,7 +80,7 @@
     <Compile Include="IO\IIsoMounter.cs" />
     <Compile Include="IO\IIsoMounter.cs" />
     <Compile Include="LiveTv\ChannelType.cs" />
     <Compile Include="LiveTv\ChannelType.cs" />
     <Compile Include="LiveTv\LiveTvServiceInfo.cs" />
     <Compile Include="LiveTv\LiveTvServiceInfo.cs" />
-    <Compile Include="LiveTv\RecordingInfo.cs" />
+    <Compile Include="LiveTv\RecordingInfoDto.cs" />
     <Compile Include="Net\WebSocketMessage.cs" />
     <Compile Include="Net\WebSocketMessage.cs" />
     <Compile Include="Net\WebSocketMessageType.cs" />
     <Compile Include="Net\WebSocketMessageType.cs" />
     <Compile Include="Net\WebSocketState.cs" />
     <Compile Include="Net\WebSocketState.cs" />
@@ -93,10 +93,10 @@
     <Compile Include="Querying\ArtistsQuery.cs" />
     <Compile Include="Querying\ArtistsQuery.cs" />
     <Compile Include="Querying\EpisodeQuery.cs" />
     <Compile Include="Querying\EpisodeQuery.cs" />
     <Compile Include="Querying\ItemCountsQuery.cs" />
     <Compile Include="Querying\ItemCountsQuery.cs" />
-    <Compile Include="Querying\ItemReviewsResult.cs" />
     <Compile Include="Querying\ItemsByNameQuery.cs" />
     <Compile Include="Querying\ItemsByNameQuery.cs" />
     <Compile Include="Entities\BaseItemInfo.cs" />
     <Compile Include="Entities\BaseItemInfo.cs" />
     <Compile Include="Querying\NextUpQuery.cs" />
     <Compile Include="Querying\NextUpQuery.cs" />
+    <Compile Include="Querying\QueryResult.cs" />
     <Compile Include="Querying\SessionQuery.cs" />
     <Compile Include="Querying\SessionQuery.cs" />
     <Compile Include="Querying\SimilarItemsQuery.cs" />
     <Compile Include="Querying\SimilarItemsQuery.cs" />
     <Compile Include="Querying\UserQuery.cs" />
     <Compile Include="Querying\UserQuery.cs" />

+ 8 - 12
MediaBrowser.Model/Querying/ItemReviewsResult.cs → MediaBrowser.Model/Querying/QueryResult.cs

@@ -1,17 +1,13 @@
-using MediaBrowser.Model.Entities;
-
+
 namespace MediaBrowser.Model.Querying
 namespace MediaBrowser.Model.Querying
 {
 {
-    /// <summary>
-    /// Class ItemReviewsResult
-    /// </summary>
-    public class ItemReviewsResult
+    public class QueryResult<T>
     {
     {
         /// <summary>
         /// <summary>
-        /// Gets or sets the item reviews.
+        /// Gets or sets the items.
         /// </summary>
         /// </summary>
-        /// <value>The item reviews.</value>
-        public ItemReview[] ItemReviews { get; set; }
+        /// <value>The items.</value>
+        public T[] Items { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// The total number of records available
         /// The total number of records available
@@ -22,9 +18,9 @@ namespace MediaBrowser.Model.Querying
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="ItemsResult" /> class.
         /// Initializes a new instance of the <see cref="ItemsResult" /> class.
         /// </summary>
         /// </summary>
-        public ItemReviewsResult()
+        public QueryResult()
         {
         {
-            ItemReviews = new ItemReview[] { };
+            Items = new T[] { };
         }
         }
-   }
+    }
 }
 }

+ 53 - 26
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -13,6 +13,7 @@ using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using MediaBrowser.Model.Querying;
 
 
 namespace MediaBrowser.Server.Implementations.LiveTv
 namespace MediaBrowser.Server.Implementations.LiveTv
 {
 {
@@ -27,12 +28,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
         private readonly IItemRepository _itemRepo;
         private readonly IItemRepository _itemRepo;
         private readonly IImageProcessor _imageProcessor;
         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 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)
         public LiveTvManager(IServerApplicationPaths appPaths, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor)
         {
         {
             _appPaths = appPaths;
             _appPaths = appPaths;
@@ -72,7 +72,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 Name = info.Name,
                 Name = info.Name,
                 ServiceName = info.ServiceName,
                 ServiceName = info.ServiceName,
                 ChannelType = info.ChannelType,
                 ChannelType = info.ChannelType,
-                ChannelId = info.ChannelId,
                 Number = info.ChannelNumber,
                 Number = info.ChannelNumber,
                 PrimaryImageTag = GetLogoImageTag(info),
                 PrimaryImageTag = GetLogoImageTag(info),
                 Type = info.GetType().Name,
                 Type = info.GetType().Name,
@@ -107,9 +106,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             return null;
             return 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;
                 double number = 0;
 
 
@@ -120,7 +119,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
 
 
                 return number;
                 return 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)
         public Channel GetChannel(string id)
@@ -135,16 +142,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             // Avoid implicitly captured closure
             // Avoid implicitly captured closure
             var currentCancellationToken = cancellationToken;
             var currentCancellationToken = cancellationToken;
 
 
-            var tasks = _services.Select(i => i.GetChannelsAsync(currentCancellationToken));
+            var channelTasks = _services.Select(i => i.GetChannelsAsync(currentCancellationToken));
 
 
             progress.Report(10);
             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 allChannels = results.SelectMany(i => i).ToList();
 
 
             var list = new List<Channel>();
             var list = new List<Channel>();
-            var guide = new Dictionary<Guid, List<ProgramInfo>>();
+            var programs = new List<ProgramInfoDto>();
 
 
             var numComplete = 0;
             var numComplete = 0;
 
 
@@ -156,18 +163,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
 
 
                     var service = GetService(channelInfo);
                     var 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);
                     list.Add(item);
-                    guide[item.Id] = programList;
                 }
                 }
                 catch (OperationCanceledException)
                 catch (OperationCanceledException)
                 {
                 {
@@ -185,10 +185,29 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 progress.Report(90 * percent + 10);
                 progress.Report(90 * percent + 10);
             }
             }
 
 
-            _guide = guide;
+            _programs = programs;
             _channels = list;
             _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)
         private async Task<Channel> GetChannel(ChannelInfo channelInfo, CancellationToken cancellationToken)
         {
         {
             var path = Path.Combine(_appPaths.ItemsByNamePath, "channels", _fileSystem.GetValidFilename(channelInfo.ServiceName), _fileSystem.GetValidFilename(channelInfo.Name));
             var path = Path.Combine(_appPaths.ItemsByNamePath, "channels", _fileSystem.GetValidFilename(channelInfo.ServiceName), _fileSystem.GetValidFilename(channelInfo.Name));
@@ -241,9 +260,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             return item;
             return 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))
             if (!string.IsNullOrEmpty(query.ServiceName))
             {
             {
@@ -255,9 +276,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList();
                 var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList();
 
 
                 programs = programs.Where(i => guids.Contains(new Guid(i.ChannelId)));
                 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
+            };
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs

@@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
 
 
                 new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
                 new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
 
 
-                new IntervalTrigger{ Interval = TimeSpan.FromHours(4)}
+                new IntervalTrigger{ Interval = TimeSpan.FromHours(2)}
             };
             };
         }
         }
     }
     }

+ 11 - 0
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) {
         self.getLiveTvRecordings = function (options) {
 
 
             var url = self.getUrl("/LiveTv/Recordings", options || {});
             var url = self.getUrl("/LiveTv/Recordings", options || {});

+ 1 - 1
MediaBrowser.WebDashboard/packages.config

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <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.Common" version="3.9.62" targetFramework="net45" />
   <package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
   <package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
 </packages>
 </packages>

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.247</version>
+        <version>3.0.248</version>
         <title>MediaBrowser.Common.Internal</title>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <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>
         <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>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <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="NLog" version="2.1.0" />
             <dependency id="ServiceStack.Text" version="3.9.58" />
             <dependency id="ServiceStack.Text" version="3.9.58" />
             <dependency id="SimpleInjector" version="2.3.6" />
             <dependency id="SimpleInjector" version="2.3.6" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Common</id>
         <id>MediaBrowser.Common</id>
-        <version>3.0.247</version>
+        <version>3.0.248</version>
         <title>MediaBrowser.Common</title>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
     <metadata>
         <id>MediaBrowser.Server.Core</id>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.247</version>
+        <version>3.0.248</version>
         <title>Media Browser.Server.Core</title>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.247" />
+            <dependency id="MediaBrowser.Common" version="3.0.248" />
         </dependencies>
         </dependencies>
     </metadata>
     </metadata>
     <files>
     <files>