فهرست منبع

graphical display of latest recordings

Luke Pulverenti 11 سال پیش
والد
کامیت
052e632a97

+ 9 - 1
MediaBrowser.Api/LiveTv/LiveTvService.cs

@@ -55,6 +55,12 @@ namespace MediaBrowser.Api.LiveTv
 
 
         [ApiMember(Name = "GroupId", Description = "Optional filter by recording group.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
         [ApiMember(Name = "GroupId", Description = "Optional filter by recording group.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
         public string GroupId { get; set; }
         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; }
     }
     }
 
 
     [Route("/LiveTv/Recordings/Groups", "GET")]
     [Route("/LiveTv/Recordings/Groups", "GET")]
@@ -259,7 +265,9 @@ namespace MediaBrowser.Api.LiveTv
             {
             {
                 ChannelId = request.ChannelId,
                 ChannelId = request.ChannelId,
                 UserId = request.UserId,
                 UserId = request.UserId,
-                GroupId = request.GroupId
+                GroupId = request.GroupId,
+                StartIndex = request.StartIndex,
+                Limit = request.Limit
 
 
             }, CancellationToken.None).Result;
             }, CancellationToken.None).Result;
 
 

+ 3 - 3
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -1,6 +1,4 @@
-using System.Globalization;
-using System.IO;
-using MediaBrowser.Controller.Dto;
+using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Movies;
 using MediaBrowser.Controller.Entities.Movies;
@@ -13,6 +11,8 @@ using MediaBrowser.Model.Querying;
 using ServiceStack;
 using ServiceStack;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
 using System.Linq;
 using System.Linq;
 
 
 namespace MediaBrowser.Api.UserLibrary
 namespace MediaBrowser.Api.UserLibrary

+ 12 - 0
MediaBrowser.Model/LiveTv/RecordingQuery.cs

@@ -28,6 +28,18 @@
         /// </summary>
         /// </summary>
         /// <value>The group identifier.</value>
         /// <value>The group identifier.</value>
         public string GroupId { get; set; }
         public string GroupId { get; set; }
+
+        /// <summary>
+        /// Skips over a given number of items within the results. Use for paging.
+        /// </summary>
+        /// <value>The start index.</value>
+        public int? StartIndex { get; set; }
+
+        /// <summary>
+        /// The maximum number of items to return
+        /// </summary>
+        /// <value>The limit.</value>
+        public int? Limit { get; set; }
     }
     }
 
 
     public class RecordingGroupQuery
     public class RecordingGroupQuery

+ 18 - 6
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -462,7 +462,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 var guid = new Guid(query.Id);
                 var guid = new Guid(query.Id);
 
 
                 var currentServiceName = service.Name;
                 var currentServiceName = service.Name;
-                
+
                 list = list
                 list = list
                     .Where(i => _tvDtoService.GetInternalRecordingId(currentServiceName, i.Id) == guid)
                     .Where(i => _tvDtoService.GetInternalRecordingId(currentServiceName, i.Id) == guid)
                     .ToList();
                     .ToList();
@@ -476,11 +476,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                     .ToList();
                     .ToList();
             }
             }
 
 
-            var entities = await GetEntities(list, service.Name, cancellationToken).ConfigureAwait(false);
+            IEnumerable<LiveTvRecording> entities = await GetEntities(list, service.Name, cancellationToken).ConfigureAwait(false);
+
+            entities = entities.OrderByDescending(i => i.RecordingInfo.StartDate);
 
 
             if (user != null)
             if (user != null)
             {
             {
-                entities = entities.Where(i => i.IsParentalAllowed(user, _localization)).ToArray();
+                var currentUser = user;
+                entities = entities.Where(i => i.IsParentalAllowed(currentUser, _localization));
+            }
+
+            if (query.StartIndex.HasValue)
+            {
+                entities = entities.Skip(query.StartIndex.Value);
+            }
+
+            if (query.Limit.HasValue)
+            {
+                entities = entities.Take(query.Limit.Value);
             }
             }
 
 
             var returnArray = entities
             var returnArray = entities
@@ -489,7 +502,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                     var channel = string.IsNullOrEmpty(i.RecordingInfo.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.RecordingInfo.ChannelId));
                     var channel = string.IsNullOrEmpty(i.RecordingInfo.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.RecordingInfo.ChannelId));
                     return _tvDtoService.GetRecordingInfoDto(i, channel, service, user);
                     return _tvDtoService.GetRecordingInfoDto(i, channel, service, user);
                 })
                 })
-                .OrderByDescending(i => i.StartDate)
                 .ToArray();
                 .ToArray();
 
 
             return new QueryResult<RecordingInfoDto>
             return new QueryResult<RecordingInfoDto>
@@ -784,10 +796,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             {
             {
                 list.Add("Others");
                 list.Add("Others");
             }
             }
-            
+
             return list;
             return list;
         }
         }
-        
+
         private List<Guid> GetRecordingGroupIds(RecordingInfo recording)
         private List<Guid> GetRecordingGroupIds(RecordingInfo recording)
         {
         {
             return GetRecordingGroupNames(recording).Select(i => i.ToLower()
             return GetRecordingGroupNames(recording).Select(i => i.ToLower()