mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
SignalR added to provide realtime episode status updates. (Series/Details and Downloading only currently)
This commit is contained in:
parent
ac84d76ef9
commit
f19721912b
19 changed files with 1871 additions and 1156 deletions
31
NzbDrone.Core/Providers/SignalRProvider.cs
Normal file
31
NzbDrone.Core/Providers/SignalRProvider.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using SignalR;
|
||||
using SignalR.Hosting.AspNet;
|
||||
using SignalR.Hubs;
|
||||
using SignalR.Infrastructure;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class SignalRProvider : Hub
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episodeStatus)
|
||||
{
|
||||
Logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus);
|
||||
|
||||
GetClients().updatedStatus(episodeId, episodeStatus.ToString());
|
||||
}
|
||||
|
||||
private static dynamic GetClients()
|
||||
{
|
||||
IConnectionManager connectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
|
||||
return connectionManager.GetClients<SignalRProvider>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue