update recording channel

This commit is contained in:
Luke Pulverenti 2018-02-03 20:22:17 -05:00
parent adbade8ba9
commit 1c0660e7a9
4 changed files with 219 additions and 13 deletions

View File

@ -19,6 +19,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
namespace MediaBrowser.Plugins.NextPvr
{
@ -181,7 +182,7 @@ namespace MediaBrowser.Plugins.NextPvr
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{RecordingInfo}}</returns>
public async Task<IEnumerable<RecordingInfo>> GetAllRecordingsAsync(CancellationToken cancellationToken)
public async Task<IEnumerable<MyRecordingInfo>> GetAllRecordingsAsync(CancellationToken cancellationToken)
{
_logger.Info("[NextPvr] Start GetRecordings Async, retrieve all 'Pending', 'Inprogress' and 'Completed' recordings ");
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
@ -991,4 +992,204 @@ namespace MediaBrowser.Plugins.NextPvr
throw new NotImplementedException();
}
}
public class MyRecordingInfo
{
/// <summary>
/// Id of the recording.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Gets or sets the series timer identifier.
/// </summary>
/// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; }
/// <summary>
/// Gets or sets the timer identifier.
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
/// <summary>
/// ChannelId of the recording.
/// </summary>
public string ChannelId { get; set; }
/// <summary>
/// Gets or sets the type of the channel.
/// </summary>
/// <value>The type of the channel.</value>
public ChannelType ChannelType { get; set; }
/// <summary>
/// Name of the recording.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
public string Url { get; set; }
/// <summary>
/// Gets or sets the overview.
/// </summary>
/// <value>The overview.</value>
public string Overview { 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>
/// Gets or sets the program identifier.
/// </summary>
/// <value>The program identifier.</value>
public string ProgramId { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public RecordingStatus Status { get; set; }
/// <summary>
/// Genre of the program.
/// </summary>
public List<string> Genres { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is repeat.
/// </summary>
/// <value><c>true</c> if this instance is repeat; otherwise, <c>false</c>.</value>
public bool IsRepeat { get; set; }
/// <summary>
/// Gets or sets the episode title.
/// </summary>
/// <value>The episode title.</value>
public string EpisodeTitle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is hd.
/// </summary>
/// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
public bool? IsHD { get; set; }
/// <summary>
/// Gets or sets the audio.
/// </summary>
/// <value>The audio.</value>
public ProgramAudio? Audio { get; set; }
/// <summary>
/// Gets or sets the original air date.
/// </summary>
/// <value>The original air date.</value>
public DateTime? OriginalAirDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is movie.
/// </summary>
/// <value><c>true</c> if this instance is movie; otherwise, <c>false</c>.</value>
public bool IsMovie { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is sports.
/// </summary>
/// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
public bool IsSports { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is series.
/// </summary>
/// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
public bool IsSeries { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is live.
/// </summary>
/// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
public bool IsLive { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is news.
/// </summary>
/// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
public bool IsNews { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is kids.
/// </summary>
/// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value>
public bool IsKids { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is premiere.
/// </summary>
/// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
public bool IsPremiere { get; set; }
/// <summary>
/// Gets or sets the official rating.
/// </summary>
/// <value>The official rating.</value>
public string OfficialRating { get; set; }
/// <summary>
/// Gets or sets the community rating.
/// </summary>
/// <value>The community rating.</value>
public float? CommunityRating { get; set; }
/// <summary>
/// Supply the image path if it can be accessed directly from the file system
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
/// <summary>
/// Supply the image url if it can be downloaded
/// </summary>
/// <value>The image URL.</value>
public string ImageUrl { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has image.
/// </summary>
/// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
public bool? HasImage { get; set; }
/// <summary>
/// Gets or sets the show identifier.
/// </summary>
/// <value>The show identifier.</value>
public string ShowId { get; set; }
/// <summary>
/// Gets or sets the date last updated.
/// </summary>
/// <value>The date last updated.</value>
public DateTime DateLastUpdated { get; set; }
public MyRecordingInfo()
{
Genres = new List<string>();
}
}
}

View File

@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;</TargetFrameworks>
<AssemblyVersion>3.2.1.0</AssemblyVersion>
<FileVersion>3.2.1.0</FileVersion>
<AssemblyVersion>3.2.3.0</AssemblyVersion>
<FileVersion>3.2.3.0</FileVersion>
</PropertyGroup>
<ItemGroup>
@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="mediabrowser.server.core" Version="3.3.23-beta" />
<PackageReference Include="mediabrowser.server.core" Version="3.3.25-beta" />
</ItemGroup>
</Project>

View File

@ -17,7 +17,7 @@ using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Plugins.NextPvr
{
public class RecordingsChannel : IChannel, IIndexableChannel, IHasCacheKey, ISupportsDelete
public class RecordingsChannel : IChannel, IHasCacheKey, ISupportsDelete, ISupportsLatestMedia
{
public ILiveTvManager _liveTvManager;
@ -144,9 +144,11 @@ namespace MediaBrowser.Plugins.NextPvr
return GetService().DeleteRecordingAsync(id, cancellationToken);
}
public Task<ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
public async Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken)
{
return GetChannelItems(new InternalChannelItemQuery(), i => true, cancellationToken);
var result = await GetChannelItems(new InternalChannelItemQuery(), i => true, cancellationToken).ConfigureAwait(false);
return result.Items.OrderByDescending(i => i.DateCreated ?? DateTime.MinValue);
}
public Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
@ -195,7 +197,7 @@ namespace MediaBrowser.Plugins.NextPvr
return Task.FromResult(result);
}
public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, Func<RecordingInfo, bool> filter, CancellationToken cancellationToken)
public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, Func<MyRecordingInfo, bool> filter, CancellationToken cancellationToken)
{
var service = GetService();
var allRecordings = await service.GetAllRecordingsAsync(cancellationToken).ConfigureAwait(false);
@ -210,7 +212,7 @@ namespace MediaBrowser.Plugins.NextPvr
return result;
}
private ChannelItemInfo ConvertToChannelItem(RecordingInfo item)
private ChannelItemInfo ConvertToChannelItem(MyRecordingInfo item)
{
var channelItem = new ChannelItemInfo
{
@ -242,7 +244,9 @@ namespace MediaBrowser.Plugins.NextPvr
DateModified = item.DateLastUpdated,
Overview = item.Overview,
//People = item.People
EnableMediaProbe = true
EnableMediaProbe = true,
IsLiveStream = item.Status == Model.LiveTv.RecordingStatus.InProgress,
Etag = item.Status.ToString()
};
return channelItem;
@ -340,4 +344,5 @@ namespace MediaBrowser.Plugins.NextPvr
return result;
}
}
}

View File

@ -24,7 +24,7 @@ namespace MediaBrowser.Plugins.NextPvr.Responses
_fileSystem = fileSystem;
}
public IEnumerable<RecordingInfo> GetRecordings(Stream stream, IJsonSerializer json,ILogger logger)
public IEnumerable<MyRecordingInfo> GetRecordings(Stream stream, IJsonSerializer json,ILogger logger)
{
if (stream == null)
{
@ -93,9 +93,9 @@ namespace MediaBrowser.Plugins.NextPvr.Responses
.Select(GetSeriesTimerInfo);
}
private RecordingInfo GetRecordingInfo(EpgEventJSONObject i)
private MyRecordingInfo GetRecordingInfo(EpgEventJSONObject i)
{
var info = new RecordingInfo();
var info = new MyRecordingInfo();
var recurr = i.recurr;
if (recurr != null)