From 03a7643b75265c5f0b03831dd58d228fde29590c Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 27 Feb 2012 21:52:03 -0800 Subject: [PATCH] SignalR will now update quality in UI as well (when applicable) --- NzbDrone.Core/Providers/DiskScanProvider.cs | 2 +- NzbDrone.Core/Providers/DownloadProvider.cs | 2 +- NzbDrone.Core/Providers/SignalRProvider.cs | 21 +++++++++++++++++--- NzbDrone.Web/Content/Images/Missing.png | Bin 5089 -> 760 bytes NzbDrone.Web/Scripts/NzbDrone/grid.js | 19 ++++++++++++------ NzbDrone.Web/Views/Series/Episode.cshtml | 2 +- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs index 9720171c8..fc024f8ea 100644 --- a/NzbDrone.Core/Providers/DiskScanProvider.cs +++ b/NzbDrone.Core/Providers/DiskScanProvider.cs @@ -202,7 +202,7 @@ public virtual bool MoveEpisodeFile(EpisodeFile episodeFile, bool newDownload = _externalNotificationProvider.OnDownload(message, series); foreach(var episode in episodes) - _signalRProvider.UpdateEpisodeStatus(episode.EpisodeId, EpisodeStatusType.Ready); + _signalRProvider.UpdateEpisodeStatus(episode.EpisodeId, EpisodeStatusType.Ready, parseResult.Quality); } else { diff --git a/NzbDrone.Core/Providers/DownloadProvider.cs b/NzbDrone.Core/Providers/DownloadProvider.cs index 426288867..f9473c0bc 100644 --- a/NzbDrone.Core/Providers/DownloadProvider.cs +++ b/NzbDrone.Core/Providers/DownloadProvider.cs @@ -67,7 +67,7 @@ public virtual bool DownloadReport(EpisodeParseResult parseResult) _historyProvider.Add(history); _episodeProvider.MarkEpisodeAsFetched(episode.EpisodeId); - _signalRProvider.UpdateEpisodeStatus(episode.EpisodeId, EpisodeStatusType.Downloading); + _signalRProvider.UpdateEpisodeStatus(episode.EpisodeId, EpisodeStatusType.Downloading, null); } _externalNotificationProvider.OnGrab(downloadTitle); diff --git a/NzbDrone.Core/Providers/SignalRProvider.cs b/NzbDrone.Core/Providers/SignalRProvider.cs index aac95512a..b815d1466 100644 --- a/NzbDrone.Core/Providers/SignalRProvider.cs +++ b/NzbDrone.Core/Providers/SignalRProvider.cs @@ -4,6 +4,7 @@ using System.Text; using NLog; using NzbDrone.Core.Model; +using NzbDrone.Core.Repository.Quality; using SignalR; using SignalR.Hosting.AspNet; using SignalR.Hubs; @@ -15,11 +16,25 @@ public class SignalRProvider : Hub { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episodeStatus) + public virtual void UpdateEpisodeStatus(int episodeId, EpisodeStatusType episodeStatus, Quality quality) { - logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus); + try + { + logger.Trace("Sending Status update to client. EpisodeId: {0}, Status: {1}", episodeId, episodeStatus); - GetClients().updatedStatus(episodeId, episodeStatus.ToString()); + GetClients().updatedStatus(new + { + EpisodeId = episodeId, + EpisodeStatus = episodeStatus.ToString(), + Quality = (quality == null ? String.Empty : quality.QualityType.ToString()) + }); + var test = 0; + } + catch (Exception ex) + { + logger.Trace("Error"); + throw; + } } private dynamic GetClients() diff --git a/NzbDrone.Web/Content/Images/Missing.png b/NzbDrone.Web/Content/Images/Missing.png index 15c3101d0692eb5f47367fc48c247ff7a6cee1d9..2bbc78831b77dbb4442a30d0d0ed1bc0e3746810 100644 GIT binary patch delta 660 zcmaE;{)2Ub#pH=xHuX$-o-U3d6}OW9{Qqx%IDn0T@yHQ_Ba99Vyp{Y6EEgtxXFy?Y z3^=Rec1%MdlkbR^gAVf%AqO3fskQt^^c#L~3fyOYG@0lBfBnU6TY<)S1R9EcI&J(DE1GqMP5TzYmr@NaR$d#IRzYk*eo#Vh&pR=mkGpHFz&EvxU9>-*m9m( zsQCmlOxOY{Z1QCH6p&;+^LzG*)`h!R6&gNNJ~*oIiNS9>1B-wizm24e+<}*34Gf2# zH&!DIC=jx$GPv--{EBV_$a$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