update closing of streams

This commit is contained in:
Luke Pulverenti
2016-09-29 08:55:49 -04:00
parent f5d37ed659
commit 76c7bfcb67
36 changed files with 481 additions and 332 deletions

View File

@@ -101,6 +101,8 @@ namespace MediaBrowser.Controller.Entities
public bool? IsMovie { get; set; }
public bool? IsSports { get; set; }
public bool? IsKids { get; set; }
public bool? IsNews { get; set; }
public bool? IsSeries { get; set; }
public int? MinPlayers { get; set; }
public int? MaxPlayers { get; set; }

View File

@@ -92,8 +92,7 @@ namespace MediaBrowser.Controller.Library
/// Closes the media source.
/// </summary>
/// <param name="id">The live stream identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task CloseLiveStream(string id, CancellationToken cancellationToken);
Task CloseLiveStream(string id);
}
}

View File

@@ -28,8 +28,7 @@ namespace MediaBrowser.Controller.Library
/// Closes the media source.
/// </summary>
/// <param name="liveStreamId">The live stream identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task CloseMediaSource(string liveStreamId, CancellationToken cancellationToken);
Task CloseMediaSource(string liveStreamId);
}
}

View File

@@ -220,9 +220,8 @@ namespace MediaBrowser.Controller.LiveTv
/// Closes the live stream.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task CloseLiveStream(string id, CancellationToken cancellationToken);
Task CloseLiveStream(string id);
/// <summary>
/// Gets the guide information.

View File

@@ -22,9 +22,8 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary>
/// Gets the channels.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;IEnumerable&lt;ChannelInfo&gt;&gt;.</returns>
Task<IEnumerable<ChannelInfo>> GetChannels(CancellationToken cancellationToken);
Task<IEnumerable<ChannelInfo>> GetChannels(bool enableCache, CancellationToken cancellationToken);
/// <summary>
/// Gets the tuner infos.
/// </summary>
@@ -46,8 +45,6 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;List&lt;MediaSourceInfo&gt;&gt;.</returns>
Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
string ApplyDuration(string streamPath, TimeSpan duration);
}
public interface IConfigurableTunerHost
{

View File

@@ -1,4 +1,5 @@
using System.Threading;
using System;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Dto;
@@ -7,17 +8,27 @@ namespace MediaBrowser.Controller.LiveTv
public class LiveStream
{
public MediaSourceInfo OriginalMediaSource { get; set; }
public MediaSourceInfo PublicMediaSource { get; set; }
public string Id { get; set; }
public MediaSourceInfo OpenedMediaSource { get; set; }
public DateTime DateOpened { get; set; }
public int ConsumerCount { get; set; }
public ITunerHost TunerHost { get; set; }
public string OriginalStreamId { get; set; }
public LiveStream(MediaSourceInfo mediaSource)
{
OriginalMediaSource = mediaSource;
PublicMediaSource = mediaSource;
Id = mediaSource.Id;
OpenedMediaSource = mediaSource;
}
public virtual Task Open(CancellationToken cancellationToken)
public async Task Open(CancellationToken cancellationToken)
{
await OpenInternal(cancellationToken).ConfigureAwait(false);
DateOpened = DateTime.UtcNow;
OpenedMediaSource.DateLiveStreamOpened = DateOpened;
}
protected virtual Task OpenInternal(CancellationToken cancellationToken)
{
return Task.FromResult(true);
}

View File

@@ -9,7 +9,7 @@ using System.Runtime.Serialization;
namespace MediaBrowser.Controller.LiveTv
{
public class LiveTvChannel : BaseItem, IHasMediaSources
public class LiveTvChannel : BaseItem, IHasMediaSources, IHasProgramAttributes
{
public override List<string> GetUserDataKeys()
{
@@ -137,5 +137,56 @@ namespace MediaBrowser.Controller.LiveTv
{
return false;
}
[IgnoreDataMember]
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>
[IgnoreDataMember]
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>
[IgnoreDataMember]
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>
[IgnoreDataMember]
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>
[IgnoreDataMember]
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>
[IgnoreDataMember]
public bool IsKids { get; set; }
[IgnoreDataMember]
public bool IsPremiere { get; set; }
[IgnoreDataMember]
public bool IsRepeat { get; set; }
/// <summary>
/// Gets or sets the episode title.
/// </summary>
/// <value>The episode title.</value>
[IgnoreDataMember]
public string EpisodeTitle { get; set; }
}
}

View File

@@ -101,6 +101,7 @@ namespace MediaBrowser.Controller.LiveTv
public bool IsMovie { get; set; }
public bool IsKids { get; set; }
public bool IsSports { get; set; }
public bool IsNews { get; set; }
public int? ProductionYear { get; set; }
public string EpisodeTitle { get; set; }
public DateTime? OriginalAirDate { get; set; }