graphical display of latest recordings
This commit is contained in:
parent
c3532d7949
commit
052e632a97
|
@ -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")]
|
||||
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")]
|
||||
|
@ -259,7 +265,9 @@ namespace MediaBrowser.Api.LiveTv
|
|||
{
|
||||
ChannelId = request.ChannelId,
|
||||
UserId = request.UserId,
|
||||
GroupId = request.GroupId
|
||||
GroupId = request.GroupId,
|
||||
StartIndex = request.StartIndex,
|
||||
Limit = request.Limit
|
||||
|
||||
}, CancellationToken.None).Result;
|
||||
|
||||
|
|
|
@ -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.Audio;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
|
@ -13,6 +11,8 @@ using MediaBrowser.Model.Querying;
|
|||
using ServiceStack;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Api.UserLibrary
|
||||
|
|
|
@ -28,6 +28,18 @@
|
|||
/// </summary>
|
||||
/// <value>The group identifier.</value>
|
||||
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
|
||||
|
|
|
@ -462,7 +462,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
var guid = new Guid(query.Id);
|
||||
|
||||
var currentServiceName = service.Name;
|
||||
|
||||
|
||||
list = list
|
||||
.Where(i => _tvDtoService.GetInternalRecordingId(currentServiceName, i.Id) == guid)
|
||||
.ToList();
|
||||
|
@ -476,11 +476,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
.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)
|
||||
{
|
||||
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
|
||||
|
@ -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));
|
||||
return _tvDtoService.GetRecordingInfoDto(i, channel, service, user);
|
||||
})
|
||||
.OrderByDescending(i => i.StartDate)
|
||||
.ToArray();
|
||||
|
||||
return new QueryResult<RecordingInfoDto>
|
||||
|
@ -784,10 +796,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
{
|
||||
list.Add("Others");
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
private List<Guid> GetRecordingGroupIds(RecordingInfo recording)
|
||||
{
|
||||
return GetRecordingGroupNames(recording).Select(i => i.ToLower()
|
||||
|
|
Loading…
Reference in New Issue
Block a user