1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-24 16:51:58 +00:00

Fixed SignalR - Its FM!

This commit is contained in:
Mark McDowall 2012-12-18 17:40:47 -08:00
parent b73f7a02d7
commit eb42272764
6 changed files with 26 additions and 7 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -19,6 +20,7 @@ public class BacklogSearchJob : IJob
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
{

View file

@ -310,6 +310,7 @@
<Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" />
<Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" />
<Compile Include="Providers\DownloadClients\PneumaticProvider.cs" />
<Compile Include="Providers\Hubs\EpisodeHub.cs" />
<Compile Include="Providers\Indexer\NzbClub.cs" />
<Compile Include="Providers\Indexer\NzbIndex.cs" />
<Compile Include="Providers\Indexer\FileSharingTalk.cs" />

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SignalR.Hubs;
namespace NzbDrone.Core.Providers.Hubs
{
public class EpisodeHub : Hub
{
}
}

View file

@ -3,16 +3,15 @@
using System.Linq;
using System.Text;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Providers.Hubs;
using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Hubs;
using SignalR.Infrastructure;
namespace NzbDrone.Core.Providers
{
public class SignalRProvider : Hub
public class SignalRProvider
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -22,7 +21,8 @@ public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episode
{
logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus);
Clients.updatedStatus(new
var context = GlobalHost.ConnectionManager.GetHubContext<EpisodeHub>();
context.Clients.updatedStatus(new
{
EpisodeId = episodeId,
EpisodeStatus = episodeStatus.ToString(),

View file

@ -19,6 +19,7 @@
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Web.Helpers.Binders;
using ServiceStack.ServiceInterface;
using SignalR;
namespace NzbDrone.Web
{
@ -71,6 +72,9 @@ protected override IKernel CreateKernel()
dispatch.Kernel.Load(Assembly.GetExecutingAssembly());
//SignalR
RouteTable.Routes.MapHubs();
//ServiceStack
dispatch.Kernel.Bind<ICacheClient>().To<MemoryCacheClient>().InSingletonScope();
dispatch.Kernel.Bind<ISessionFactory>().To<SessionFactory>().InSingletonScope();

View file

@ -66,10 +66,10 @@ function reloadGrid() {
//SignalR
$(function () {
// Proxy created on the fly
var signalRProvider = $.connection.signalRProvider;
var episodeHub = $.connection.episodeHub;
// Declare a function on the chat hub so the server can invoke it
signalRProvider.updatedStatus = function (data) {
episodeHub.updatedStatus = function (data) {
var row = $('[data-episode-id="' + data.EpisodeId + '"]');
if (row.length == 0)