added live tv events

pull/702/head
Luke Pulverenti 11 years ago
parent c07d958df9
commit ca831ae88a

@ -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; }
}
}

@ -10,6 +10,16 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
public interface ILiveTvService 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> /// <summary>
/// Gets the name. /// Gets the name.
/// </summary> /// </summary>

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

@ -2,6 +2,7 @@
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
@ -748,6 +749,22 @@ namespace MediaBrowser.Model.ApiClient
/// <exception cref="ArgumentNullException">item</exception> /// <exception cref="ArgumentNullException">item</exception>
string GetImageUrl(BaseItemDto item, ImageOptions options); 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> /// <summary>
/// Gets an image url that can be used to download an image from the api /// Gets an image url that can be used to download an image from the api
/// </summary> /// </summary>
@ -918,5 +935,36 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">options</exception> /// <exception cref="ArgumentNullException">options</exception>
string GetHlsVideoStreamUrl(VideoStreamOptions options); 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);
} }
} }

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

@ -1,5 +1,6 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
@ -37,6 +38,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly IUserDataManager _userDataManager; private readonly IUserDataManager _userDataManager;
private readonly ILibraryManager _libraryManager; private readonly ILibraryManager _libraryManager;
private readonly IMediaEncoder _mediaEncoder; private readonly IMediaEncoder _mediaEncoder;
private readonly ITaskManager _taskManager;
private readonly LiveTvDtoService _tvDtoService; private readonly LiveTvDtoService _tvDtoService;
@ -81,7 +83,27 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
_services.AddRange(services); _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) public Task<QueryResult<ChannelInfoDto>> GetChannels(ChannelQuery query, CancellationToken cancellationToken)

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

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.301</version> <version>3.0.302</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <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> <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> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <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="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.0" /> <dependency id="SimpleInjector" version="2.4.0" />
<dependency id="sharpcompress" version="0.10.2" /> <dependency id="sharpcompress" version="0.10.2" />

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

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.301</version> <version>3.0.302</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.301" /> <dependency id="MediaBrowser.Common" version="3.0.302" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>

Loading…
Cancel
Save