display programs on channel page
This commit is contained in:
parent
4054846a6e
commit
a641059c57
|
@ -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.Api
|
|||
reviewsArray = reviewsArray.Take(request.Limit.Value).ToArray();
|
||||
}
|
||||
|
||||
result.ItemReviews = reviewsArray;
|
||||
result.Items = reviewsArray;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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.LiveTv
|
|||
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")]
|
||||
[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.LiveTv
|
|||
ServiceName = 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.LiveTv
|
|||
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)
|
||||
{
|
||||
var result = _liveTvManager.GetPrograms(new ProgramQuery
|
||||
|
@ -152,7 +119,7 @@ namespace MediaBrowser.Api.LiveTv
|
|||
ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray()
|
||||
});
|
||||
|
||||
return ToOptimizedResult(result.ToList());
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
49
MediaBrowser.Controller/LiveTv/ProgramInfo.cs
Normal file
49
MediaBrowser.Controller/LiveTv/ProgramInfo.cs
Normal file
|
@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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" />
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,32 +1,39 @@
|
|||
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>
|
||||
/// <value>The channel identifier.</value>
|
||||
public string ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the recording identifier.
|
||||
/// </summary>
|
||||
/// <value>The recording identifier.</value>
|
||||
public string RecordingId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the service.
|
||||
/// </summary>
|
||||
/// <value>The name of the service.</value>
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the external channel identifier.
|
||||
/// </summary>
|
||||
/// <value>The external channel identifier.</value>
|
||||
public string ExternalChannelId { 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>();
|
||||
}
|
||||
}
|
||||
}
|
78
MediaBrowser.Model/LiveTv/RecordingInfoDto.cs
Normal file
78
MediaBrowser.Model/LiveTv/RecordingInfoDto.cs
Normal file
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.LiveTv
|
|||
private 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.LiveTv
|
|||
Name = 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.LiveTv
|
|||
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;
|
||||
|
||||
|
@ -120,7 +119,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
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)
|
||||
|
@ -135,16 +142,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
// Avoid implicitly captured closure
|
||||
var 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.LiveTv
|
|||
|
||||
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);
|
||||
guide[item.Id] = programList;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -185,10 +185,29 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
progress.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.LiveTv
|
|||
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))
|
||||
{
|
||||
|
@ -255,9 +276,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
var 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},
|
||||
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(4)}
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(2)}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 || {});
|
||||
|
|
|
@ -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>
|
|
@ -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" />
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user