2012-02-12 09:52:51 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
2012-02-12 23:37:55 +00:00
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
2012-02-12 09:52:51 +00:00
|
|
|
|
|
|
|
|
|
public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episodeStatus)
|
|
|
|
|
{
|
2012-02-12 23:37:55 +00:00
|
|
|
|
logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus);
|
2012-02-12 09:52:51 +00:00
|
|
|
|
|
|
|
|
|
GetClients().updatedStatus(episodeId, episodeStatus.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-13 01:07:09 +00:00
|
|
|
|
private dynamic GetClients()
|
2012-02-12 09:52:51 +00:00
|
|
|
|
{
|
2012-02-12 23:37:55 +00:00
|
|
|
|
var connectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
|
2012-02-12 09:52:51 +00:00
|
|
|
|
return connectionManager.GetClients<SignalRProvider>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|