mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 05:34:16 -04:00
add tv service status reporting
This commit is contained in:
parent
7d81888038
commit
b469012304
@ -5,7 +5,6 @@ using MediaBrowser.Model.LiveTv;
|
|||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -83,7 +82,7 @@ namespace MediaBrowser.Api.LiveTv
|
|||||||
|
|
||||||
[ApiMember(Name = "Status", Description = "Optional filter by recordings that are in progress, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Status", Description = "Optional filter by recordings that are in progress, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||||
public bool? IsInProgress { get; set; }
|
public bool? IsInProgress { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string SeriesTimerId { get; set; }
|
public string SeriesTimerId { get; set; }
|
||||||
}
|
}
|
||||||
@ -295,27 +294,17 @@ namespace MediaBrowser.Api.LiveTv
|
|||||||
|
|
||||||
public object Get(GetLiveTvInfo request)
|
public object Get(GetLiveTvInfo request)
|
||||||
{
|
{
|
||||||
var services = _liveTvManager.Services
|
var services = _liveTvManager.GetServiceInfos(CancellationToken.None).Result;
|
||||||
.Select(GetServiceInfo)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var info = new LiveTvInfo
|
var info = new LiveTvInfo
|
||||||
{
|
{
|
||||||
Services = services,
|
Services = services.ToList(),
|
||||||
ActiveServiceName = _liveTvManager.ActiveService == null ? null : _liveTvManager.ActiveService.Name
|
ActiveServiceName = _liveTvManager.ActiveService == null ? null : _liveTvManager.ActiveService.Name
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedResult(info);
|
return ToOptimizedResult(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LiveTvServiceInfo GetServiceInfo(ILiveTvService service)
|
|
||||||
{
|
|
||||||
return new LiveTvServiceInfo
|
|
||||||
{
|
|
||||||
Name = service.Name
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Get(GetChannels request)
|
public object Get(GetChannels request)
|
||||||
{
|
{
|
||||||
var result = _liveTvManager.GetChannels(new ChannelQuery
|
var result = _liveTvManager.GetChannels(new ChannelQuery
|
||||||
|
@ -24,6 +24,13 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// <value>The services.</value>
|
/// <value>The services.</value>
|
||||||
IReadOnlyList<ILiveTvService> Services { get; }
|
IReadOnlyList<ILiveTvService> Services { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the service infos.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{IEnumerable{LiveTvServiceInfo}}.</returns>
|
||||||
|
Task<IEnumerable<LiveTvServiceInfo>> GetServiceInfos(CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the new timer defaults asynchronous.
|
/// Gets the new timer defaults asynchronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -26,6 +26,13 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the status information asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{LiveTvServiceStatusInfo}.</returns>
|
||||||
|
Task<LiveTvServiceStatusInfo> GetStatusInfoAsync(CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channels async.
|
/// Gets the channels async.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
19
MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs
Normal file
19
MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using MediaBrowser.Model.LiveTv;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.LiveTv
|
||||||
|
{
|
||||||
|
public class LiveTvServiceStatusInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the status.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The status.</value>
|
||||||
|
public LiveTvServiceStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the status message.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The status message.</value>
|
||||||
|
public string StatusMessage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -121,6 +121,7 @@
|
|||||||
<Compile Include="LiveTv\ILiveTvManager.cs" />
|
<Compile Include="LiveTv\ILiveTvManager.cs" />
|
||||||
<Compile Include="LiveTv\ILiveTvService.cs" />
|
<Compile Include="LiveTv\ILiveTvService.cs" />
|
||||||
<Compile Include="LiveTv\LiveTvException.cs" />
|
<Compile Include="LiveTv\LiveTvException.cs" />
|
||||||
|
<Compile Include="LiveTv\LiveTvServiceStatusInfo.cs" />
|
||||||
<Compile Include="LiveTv\StreamResponseInfo.cs" />
|
<Compile Include="LiveTv\StreamResponseInfo.cs" />
|
||||||
<Compile Include="LiveTv\LiveTvProgram.cs" />
|
<Compile Include="LiveTv\LiveTvProgram.cs" />
|
||||||
<Compile Include="LiveTv\LiveTvVideoRecording.cs" />
|
<Compile Include="LiveTv\LiveTvVideoRecording.cs" />
|
||||||
|
@ -951,6 +951,15 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
/// <returns>Task{LiveTvInfo}.</returns>
|
/// <returns>Task{LiveTvInfo}.</returns>
|
||||||
Task<QueryResult<ChannelInfoDto>> GetLiveTvChannelsAsync(ChannelQuery query, CancellationToken cancellationToken);
|
Task<QueryResult<ChannelInfoDto>> GetLiveTvChannelsAsync(ChannelQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv channel asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="userId">The user identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{ChannelInfoDto}.</returns>
|
||||||
|
Task<ChannelInfoDto> GetLiveTvChannelAsync(string id, string userId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the live tv recordings asynchronous.
|
/// Gets the live tv recordings asynchronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -959,6 +968,15 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
/// <returns>Task{QueryResult{RecordingInfoDto}}.</returns>
|
/// <returns>Task{QueryResult{RecordingInfoDto}}.</returns>
|
||||||
Task<QueryResult<RecordingInfoDto>> GetLiveTvRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken);
|
Task<QueryResult<RecordingInfoDto>> GetLiveTvRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv recording asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="userId">The user identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{RecordingInfoDto}.</returns>
|
||||||
|
Task<RecordingInfoDto> GetLiveTvRecordingAsync(string id, string userId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the live tv recording groups asynchronous.
|
/// Gets the live tv recording groups asynchronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -966,5 +984,70 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{QueryResult{RecordingGroupDto}}.</returns>
|
/// <returns>Task{QueryResult{RecordingGroupDto}}.</returns>
|
||||||
Task<QueryResult<RecordingGroupDto>> GetLiveTvRecordingGroupsAsync(RecordingGroupQuery query, CancellationToken cancellationToken);
|
Task<QueryResult<RecordingGroupDto>> GetLiveTvRecordingGroupsAsync(RecordingGroupQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv recording group asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="userId">The user identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{RecordingGroupDto}.</returns>
|
||||||
|
Task<RecordingGroupDto> GetLiveTvRecordingGroupAsync(string id, string userId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv timers asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">The query.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{QueryResult{TimerInfoDto}}.</returns>
|
||||||
|
Task<QueryResult<TimerInfoDto>> GetLiveTvTimersAsync(TimerQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{TimerInfoDto}.</returns>
|
||||||
|
Task<TimerInfoDto> GetLiveTvTimerAsync(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv series timers asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">The query.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{QueryResult{SeriesTimerInfoDto}}.</returns>
|
||||||
|
Task<QueryResult<SeriesTimerInfoDto>> GetLiveTvSeriesTimersAsync(SeriesTimerQuery query, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the live tv series timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task{SeriesTimerInfoDto}.</returns>
|
||||||
|
Task<SeriesTimerInfoDto> GetLiveTvSeriesTimerAsync(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the live tv timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task CancelLiveTvTimerAsync(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels the live tv series timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task CancelLiveTvSeriesTimerAsync(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the live tv recording asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task DeleteLiveTvRecordingAsync(string id, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -234,7 +234,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
MediaEncodingQuality = EncodingQuality.HighSpeed;
|
MediaEncodingQuality = EncodingQuality.HighSpeed;
|
||||||
ImageSavingConvention = ImageSavingConvention.Legacy;
|
ImageSavingConvention = ImageSavingConvention.Compatible;
|
||||||
HttpServerPortNumber = 8096;
|
HttpServerPortNumber = 8096;
|
||||||
LegacyWebSocketPortNumber = 8945;
|
LegacyWebSocketPortNumber = 8945;
|
||||||
EnableHttpLevelLogging = true;
|
EnableHttpLevelLogging = true;
|
||||||
|
@ -13,6 +13,18 @@ namespace MediaBrowser.Model.LiveTv
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the status.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The status.</value>
|
||||||
|
public LiveTvServiceStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the status message.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The status message.</value>
|
||||||
|
public string StatusMessage { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GuideInfo
|
public class GuideInfo
|
||||||
@ -49,4 +61,10 @@ namespace MediaBrowser.Model.LiveTv
|
|||||||
Services = new List<LiveTvServiceInfo>();
|
Services = new List<LiveTvServiceInfo>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LiveTvServiceStatus
|
||||||
|
{
|
||||||
|
Ok = 0,
|
||||||
|
Unavailable = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1130,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
await service.UpdateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
await service.UpdateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> GetRecordingGroupNames(RecordingInfo recording)
|
private IEnumerable<string> GetRecordingGroupNames(RecordingInfo recording)
|
||||||
{
|
{
|
||||||
var list = new List<string>();
|
var list = new List<string>();
|
||||||
|
|
||||||
@ -1292,5 +1292,37 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<LiveTvServiceInfo>> GetServiceInfos(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var tasks = Services.Select(i => GetServiceInfo(i, cancellationToken));
|
||||||
|
|
||||||
|
return await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<LiveTvServiceInfo> GetServiceInfo(ILiveTvService service, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var info = new LiveTvServiceInfo
|
||||||
|
{
|
||||||
|
Name = service.Name
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var statusInfo = await service.GetStatusInfoAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
info.Status = statusInfo.Status;
|
||||||
|
info.StatusMessage = statusInfo.StatusMessage;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error getting service status info from {0}", ex, service.Name);
|
||||||
|
|
||||||
|
info.Status = LiveTvServiceStatus.Unavailable;
|
||||||
|
info.StatusMessage = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,6 +421,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
LocalizedStrings.ApplicationPaths = ApplicationPaths;
|
LocalizedStrings.ApplicationPaths = ApplicationPaths;
|
||||||
Folder.UserManager = UserManager;
|
Folder.UserManager = UserManager;
|
||||||
BaseItem.FileSystem = FileSystemManager;
|
BaseItem.FileSystem = FileSystemManager;
|
||||||
|
BaseItem.UserDataManager = UserDataManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -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.302</version>
|
<version>3.0.303</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.302" />
|
<dependency id="MediaBrowser.Common" version="3.0.303" />
|
||||||
<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.302</version>
|
<version>3.0.303</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.302</version>
|
<version>3.0.303</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.302" />
|
<dependency id="MediaBrowser.Common" version="3.0.303" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user