diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-16 12:23:30 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-01-16 12:23:30 -0500 |
| commit | b4690123049a70a11101b27af6baaee3572d1549 (patch) | |
| tree | d56b5bb7890ba76180877de0cbbbe403af830b1a /MediaBrowser.Server.Implementations | |
| parent | 7d81888038a007eb84c6240acb80bf7ca611eb5c (diff) | |
add tv service status reporting
Diffstat (limited to 'MediaBrowser.Server.Implementations')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 5781dd69a9..2269ab0c52 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1130,7 +1130,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.UpdateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false); } - private List<string> GetRecordingGroupNames(RecordingInfo recording) + private IEnumerable<string> GetRecordingGroupNames(RecordingInfo recording) { 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; + } } } |
