1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Core/Providers/SignalRProvider.cs

39 lines
1.3 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Model;
2012-12-19 04:40:47 +03:00
using NzbDrone.Core.Providers.Hubs;
using SignalR;
using SignalR.Hubs;
namespace NzbDrone.Core.Providers
{
2012-12-19 04:40:47 +03:00
public class SignalRProvider
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
2012-10-14 00:15:21 +03:00
public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episodeStatus, QualityModel quality)
{
try
{
logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus);
2012-12-19 04:40:47 +03:00
var context = GlobalHost.ConnectionManager.GetHubContext<EpisodeHub>();
context.Clients.updatedStatus(new
{
EpisodeId = episodeId,
EpisodeStatus = episodeStatus.ToString(),
2012-10-14 03:36:16 +03:00
Quality = (quality == null ? String.Empty : quality.Quality.ToString())
});
}
catch (Exception ex)
{
2012-11-21 19:14:57 +03:00
logger.TraceException("Error", ex);
throw;
}
}
}
}