mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using MediaBrowser.Common.Net;
|
|
using MediaBrowser.Controller;
|
|
using MediaBrowser.Model.Logging;
|
|
using MediaBrowser.Model.System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Api.WebSocket
|
|
{
|
|
/// <summary>
|
|
/// Class SystemInfoWebSocketListener
|
|
/// </summary>
|
|
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, object>
|
|
{
|
|
/// <summary>
|
|
/// Gets the name.
|
|
/// </summary>
|
|
/// <value>The name.</value>
|
|
protected override string Name
|
|
{
|
|
get { return "SystemInfo"; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The _kernel
|
|
/// </summary>
|
|
private readonly IServerApplicationHost _appHost;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
|
|
/// </summary>
|
|
/// <param name="logger">The logger.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
public SystemInfoWebSocketListener(ILogger logger, IServerApplicationHost appHost)
|
|
: base(logger)
|
|
{
|
|
_appHost = appHost;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the data to send.
|
|
/// </summary>
|
|
/// <param name="state">The state.</param>
|
|
/// <returns>Task{SystemInfo}.</returns>
|
|
protected override Task<SystemInfo> GetDataToSend(object state)
|
|
{
|
|
return Task.FromResult(_appHost.GetSystemInfo());
|
|
}
|
|
}
|
|
}
|