2013-03-07 05:34:00 +00:00
|
|
|
|
using MediaBrowser.Common.Net;
|
2013-02-23 07:57:11 +00:00
|
|
|
|
using MediaBrowser.Common.ScheduledTasks;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
2013-02-27 20:25:45 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2013-02-21 20:26:35 +00:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
using System.ComponentModel.Composition;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.WebDashboard.Api
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class DashboardInfoWebSocketListener
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Export(typeof(IWebSocketListener))]
|
2013-02-22 15:16:48 +00:00
|
|
|
|
class DashboardInfoWebSocketListener : BasePeriodicWebSocketListener<DashboardInfo, object>
|
2013-02-21 01:33:05 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the name.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The name.</value>
|
|
|
|
|
protected override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "DashboardInfo"; }
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-07 05:34:00 +00:00
|
|
|
|
private readonly IServerApplicationHost _appHost;
|
2013-02-22 15:16:48 +00:00
|
|
|
|
|
2013-02-23 07:57:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the task manager.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The task manager.</value>
|
|
|
|
|
private readonly ITaskManager _taskManager;
|
|
|
|
|
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _user manager
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IUserManager _userManager;
|
2013-03-12 22:49:45 +00:00
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
2013-02-27 20:25:45 +00:00
|
|
|
|
|
2013-02-21 20:26:35 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="DashboardInfoWebSocketListener" /> class.
|
|
|
|
|
/// </summary>
|
2013-04-03 02:59:27 +00:00
|
|
|
|
/// <param name="appHost">The app host.</param>
|
2013-02-21 20:26:35 +00:00
|
|
|
|
/// <param name="logger">The logger.</param>
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <param name="taskManager">The task manager.</param>
|
|
|
|
|
/// <param name="userManager">The user manager.</param>
|
2013-04-03 02:59:27 +00:00
|
|
|
|
/// <param name="libraryManager">The library manager.</param>
|
2013-03-13 20:57:19 +00:00
|
|
|
|
public DashboardInfoWebSocketListener(IServerApplicationHost appHost, ILogger logger, ITaskManager taskManager, IUserManager userManager, ILibraryManager libraryManager)
|
2013-02-21 20:26:35 +00:00
|
|
|
|
: base(logger)
|
|
|
|
|
{
|
2013-03-07 05:34:00 +00:00
|
|
|
|
_appHost = appHost;
|
2013-02-23 07:57:11 +00:00
|
|
|
|
_taskManager = taskManager;
|
2013-02-27 20:25:45 +00:00
|
|
|
|
_userManager = userManager;
|
2013-03-13 20:57:19 +00:00
|
|
|
|
_libraryManager = libraryManager;
|
2013-02-21 20:26:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-02-21 01:33:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the data to send.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="state">The state.</param>
|
|
|
|
|
/// <returns>Task{IEnumerable{TaskInfo}}.</returns>
|
|
|
|
|
protected override Task<DashboardInfo> GetDataToSend(object state)
|
|
|
|
|
{
|
2013-04-17 22:30:20 +00:00
|
|
|
|
return DashboardService.GetDashboardInfo(_appHost, Logger, _taskManager, _userManager, _libraryManager);
|
2013-02-21 01:33:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|