added live tv events

This commit is contained in:
Luke Pulverenti 2014-01-15 00:38:08 -05:00
parent c07d958df9
commit ca831ae88a
10 changed files with 102 additions and 10 deletions

View File

@ -0,0 +1,12 @@
using MediaBrowser.Model.LiveTv;
using System;
namespace MediaBrowser.Controller.LiveTv
{
public class RecordingStatusChangedEventArgs : EventArgs
{
public string RecordingId { get; set; }
public RecordingStatus NewStatus { get; set; }
}
}

View File

@ -10,6 +10,16 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
public interface ILiveTvService
{
/// <summary>
/// Occurs when [data source changed].
/// </summary>
event EventHandler DataSourceChanged;
/// <summary>
/// Occurs when [recording status changed].
/// </summary>
event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
/// <summary>
/// Gets the name.
/// </summary>

View File

@ -112,6 +112,7 @@
<Compile Include="Library\ItemUpdateType.cs" />
<Compile Include="Library\IUserDataManager.cs" />
<Compile Include="Library\UserDataSaveEventArgs.cs" />
<Compile Include="LiveTv\EventArgs.cs" />
<Compile Include="LiveTv\ILiveTvRecording.cs" />
<Compile Include="LiveTv\LiveStreamInfo.cs" />
<Compile Include="LiveTv\LiveTvAudioRecording.cs" />

View File

@ -2,6 +2,7 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Querying;
@ -748,6 +749,22 @@ namespace MediaBrowser.Model.ApiClient
/// <exception cref="ArgumentNullException">item</exception>
string GetImageUrl(BaseItemDto item, ImageOptions options);
/// <summary>
/// Gets the image URL.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
string GetImageUrl(ChannelInfoDto item, ImageOptions options);
/// <summary>
/// Gets the image URL.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
string GetImageUrl(RecordingInfoDto item, ImageOptions options);
/// <summary>
/// Gets an image url that can be used to download an image from the api
/// </summary>
@ -918,5 +935,36 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">options</exception>
string GetHlsVideoStreamUrl(VideoStreamOptions options);
/// <summary>
/// Gets the live tv information asynchronous.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{LiveTvInfo}.</returns>
Task<LiveTvInfo> GetLiveTvInfoAsync(CancellationToken cancellationToken);
/// <summary>
/// Gets the live tv channels asynchronous.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{LiveTvInfo}.</returns>
Task<QueryResult<ChannelInfoDto>> GetLiveTvChannelsAsync(ChannelQuery query, CancellationToken cancellationToken);
/// <summary>
/// Gets the live tv recordings asynchronous.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{RecordingInfoDto}}.</returns>
Task<QueryResult<RecordingInfoDto>> GetLiveTvRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken);
/// <summary>
/// Gets the live tv recording groups asynchronous.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{RecordingGroupDto}}.</returns>
Task<QueryResult<RecordingGroupDto>> GetLiveTvRecordingGroupsAsync(RecordingGroupQuery query, CancellationToken cancellationToken);
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.LiveTv
{

View File

@ -1,5 +1,6 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
@ -37,6 +38,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly IUserDataManager _userDataManager;
private readonly ILibraryManager _libraryManager;
private readonly IMediaEncoder _mediaEncoder;
private readonly ITaskManager _taskManager;
private readonly LiveTvDtoService _tvDtoService;
@ -81,7 +83,27 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
_services.AddRange(services);
ActiveService = _services.FirstOrDefault();
SetActiveService(_services.FirstOrDefault());
}
private void SetActiveService(ILiveTvService service)
{
if (ActiveService != null)
{
ActiveService.DataSourceChanged -= service_DataSourceChanged;
}
ActiveService = service;
if (service != null)
{
service.DataSourceChanged += service_DataSourceChanged;
}
}
void service_DataSourceChanged(object sender, EventArgs e)
{
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
}
public Task<QueryResult<ChannelInfoDto>> GetChannels(ChannelQuery query, CancellationToken cancellationToken)

View File

@ -42,7 +42,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
return new ITaskTrigger[]
{
new StartupTrigger(),
new SystemEventTrigger{ SystemEvent = SystemEvent.WakeFromSleep},

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.301</version>
<version>3.0.302</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.301" />
<dependency id="MediaBrowser.Common" version="3.0.302" />
<dependency id="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.0" />
<dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.301</version>
<version>3.0.302</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.301</version>
<version>3.0.302</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.301" />
<dependency id="MediaBrowser.Common" version="3.0.302" />
</dependencies>
</metadata>
<files>