diff --git a/src/MediaInfoDotNet.dll.config b/src/MediaInfoDotNet.dll.config
index 3de7bdea3..4fe730868 100644
--- a/src/MediaInfoDotNet.dll.config
+++ b/src/MediaInfoDotNet.dll.config
@@ -2,4 +2,5 @@
+
diff --git a/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs b/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs
new file mode 100644
index 000000000..284316203
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/033_add_api_key_to_pushover.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Data;
+using FluentMigrator;
+using NzbDrone.Common.Serializer;
+using NzbDrone.Core.Datastore.Migration.Framework;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(33)]
+ public class add_api_key_to_pushover : NzbDroneMigrationBase
+ {
+ private const string API_KEY = "yz9b4U215iR4vrKFRfjNXP24NMNPKJ";
+
+ protected override void MainDbUpgrade()
+ {
+ Execute.WithConnection(UpdatePushoverSettings);
+ }
+
+ private void UpdatePushoverSettings(IDbConnection conn, IDbTransaction tran)
+ {
+ using (IDbCommand selectCommand = conn.CreateCommand())
+ {
+ selectCommand.Transaction = tran;
+ selectCommand.CommandText = @"SELECT * FROM Notifications WHERE ConfigContract = 'PushoverSettings'";
+
+ using (IDataReader reader = selectCommand.ExecuteReader())
+ {
+ while (reader.Read())
+ {
+ var idIndex = reader.GetOrdinal("Id");
+ var settingsIndex = reader.GetOrdinal("Settings");
+
+ var id = reader.GetInt32(idIndex);
+ var settings = Json.Deserialize(reader.GetString(settingsIndex));
+ settings.ApiKey = API_KEY;
+
+ //Set priority to high if its currently emergency
+ if (settings.Priority == 2)
+ {
+ settings.Priority = 1;
+ }
+
+ using (IDbCommand updateCmd = conn.CreateCommand())
+ {
+ var text = String.Format("UPDATE Notifications " +
+ "SET Settings = '{0}'" +
+ "WHERE Id = {1}",
+ settings.ToJson(), id
+ );
+
+ updateCmd.Transaction = tran;
+ updateCmd.CommandText = text;
+ updateCmd.ExecuteNonQuery();
+ }
+ }
+ }
+ }
+ }
+
+ private class PushoverSettingsForV33
+ {
+ public String ApiKey { get; set; }
+ public String UserKey { get; set; }
+ public Int32 Priority { get; set; }
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCommunicationProxy.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCommunicationProxy.cs
index ebdcca7ed..a372185eb 100644
--- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCommunicationProxy.cs
+++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCommunicationProxy.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using Newtonsoft.Json;
using NLog;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Configuration;
diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs
index dcb9742a9..15acf13b2 100644
--- a/src/NzbDrone.Core/Download/DownloadService.cs
+++ b/src/NzbDrone.Core/Download/DownloadService.cs
@@ -44,10 +44,10 @@ namespace NzbDrone.Core.Download
var downloadClientId = downloadClient.DownloadNzb(remoteEpisode);
var episodeGrabbedEvent = new EpisodeGrabbedEvent(remoteEpisode);
+ episodeGrabbedEvent.DownloadClient = downloadClient.GetType().Name;
if (!String.IsNullOrWhiteSpace(downloadClientId))
{
- episodeGrabbedEvent.DownloadClient = downloadClient.GetType().Name;
episodeGrabbedEvent.DownloadClientId = downloadClientId;
}
diff --git a/src/NzbDrone.Core/Download/FailedDownloadService.cs b/src/NzbDrone.Core/Download/FailedDownloadService.cs
index 4671ec150..d7334c990 100644
--- a/src/NzbDrone.Core/Download/FailedDownloadService.cs
+++ b/src/NzbDrone.Core/Download/FailedDownloadService.cs
@@ -132,14 +132,20 @@ namespace NzbDrone.Core.Download
private void PublishDownloadFailedEvent(List historyItems, string message)
{
var historyItem = historyItems.First();
+ string downloadClient;
+ string downloadClientId;
+
+ historyItem.Data.TryGetValue(DOWNLOAD_CLIENT, out downloadClient);
+ historyItem.Data.TryGetValue(DOWNLOAD_CLIENT_ID, out downloadClientId);
+
_eventAggregator.PublishEvent(new DownloadFailedEvent
{
SeriesId = historyItem.SeriesId,
EpisodeIds = historyItems.Select(h => h.EpisodeId).ToList(),
Quality = historyItem.Quality,
SourceTitle = historyItem.SourceTitle,
- DownloadClient = historyItem.Data[DOWNLOAD_CLIENT],
- DownloadClientId = historyItem.Data[DOWNLOAD_CLIENT_ID],
+ DownloadClient = downloadClient,
+ DownloadClientId = downloadClientId,
Message = message
});
}
diff --git a/src/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs
index 636d092d0..4c8758618 100644
--- a/src/NzbDrone.Core/History/HistoryService.cs
+++ b/src/NzbDrone.Core/History/HistoryService.cs
@@ -103,10 +103,10 @@ namespace NzbDrone.Core.History
history.Data.Add("NzbInfoUrl", message.Episode.Release.InfoUrl);
history.Data.Add("ReleaseGroup", message.Episode.ParsedEpisodeInfo.ReleaseGroup);
history.Data.Add("Age", message.Episode.Release.Age.ToString());
+ history.Data.Add("DownloadClient", message.DownloadClient);
if (!String.IsNullOrWhiteSpace(message.DownloadClientId))
{
- history.Data.Add("DownloadClient", message.DownloadClient);
history.Data.Add("DownloadClientId", message.DownloadClientId);
}
diff --git a/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs b/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs
index a9f447c0f..36258ebea 100644
--- a/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs
+++ b/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs
@@ -20,14 +20,14 @@ namespace NzbDrone.Core.Notifications.Pushover
{
const string title = "Episode Grabbed";
- _pushoverProxy.SendNotification(title, message, Settings.UserKey, (PushoverPriority)Settings.Priority);
+ _pushoverProxy.SendNotification(title, message, Settings.ApiKey, Settings.UserKey, (PushoverPriority)Settings.Priority);
}
public override void OnDownload(DownloadMessage message)
{
const string title = "Episode Downloaded";
- _pushoverProxy.SendNotification(title, message.Message, Settings.UserKey, (PushoverPriority)Settings.Priority);
+ _pushoverProxy.SendNotification(title, message.Message, Settings.ApiKey, Settings.UserKey, (PushoverPriority)Settings.Priority);
}
public override void AfterRename(Series series)
diff --git a/src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs
index 2e159b200..6ad6c5339 100644
--- a/src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs
+++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs
@@ -5,6 +5,6 @@
Quiet = -1,
Normal = 0,
High = 1,
- Emergency = 2
+ //Emergency = 2
}
}
diff --git a/src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs
index 9813b9464..7527d3b66 100644
--- a/src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs
+++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs
@@ -6,19 +6,18 @@ namespace NzbDrone.Core.Notifications.Pushover
{
public interface IPushoverProxy
{
- void SendNotification(string title, string message, string userKey, PushoverPriority priority);
+ void SendNotification(string title, string message, string apiKey, string userKey, PushoverPriority priority);
}
public class PushoverProxy : IPushoverProxy, IExecute
{
- private const string TOKEN = "yz9b4U215iR4vrKFRfjNXP24NMNPKJ";
private const string URL = "https://api.pushover.net/1/messages.json";
- public void SendNotification(string title, string message, string userKey, PushoverPriority priority)
+ public void SendNotification(string title, string message, string apiKey, string userKey, PushoverPriority priority)
{
var client = new RestClient(URL);
var request = new RestRequest(Method.POST);
- request.AddParameter("token", TOKEN);
+ request.AddParameter("token", apiKey);
request.AddParameter("user", userKey);
request.AddParameter("title", title);
request.AddParameter("message", message);
@@ -32,7 +31,7 @@ namespace NzbDrone.Core.Notifications.Pushover
const string title = "Test Notification";
const string body = "This is a test message from NzbDrone";
- SendNotification(title, body, message.UserKey, (PushoverPriority)message.Priority);
+ SendNotification(title, body, message.ApiKey, message.UserKey, (PushoverPriority)message.Priority);
}
}
}
diff --git a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs
index debf640e2..178ef3bd8 100644
--- a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs
+++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs
@@ -18,10 +18,13 @@ namespace NzbDrone.Core.Notifications.Pushover
{
private static readonly PushoverSettingsValidator Validator = new PushoverSettingsValidator();
- [FieldDefinition(0, Label = "User Key", HelpLink = "https://pushover.net/")]
+ [FieldDefinition(0, Label = "API Key", HelpLink = "https://pushover.net/apps/clone/nzbdrone")]
+ public String ApiKey { get; set; }
+
+ [FieldDefinition(1, Label = "User Key", HelpLink = "https://pushover.net/")]
public String UserKey { get; set; }
- [FieldDefinition(1, Label = "Priority", Type = FieldType.Select, SelectOptions = typeof(PushoverPriority) )]
+ [FieldDefinition(2, Label = "Priority", Type = FieldType.Select, SelectOptions = typeof(PushoverPriority) )]
public Int32 Priority { get; set; }
public bool IsValid
diff --git a/src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs b/src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs
index 13e232401..235679d57 100644
--- a/src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs
+++ b/src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs
@@ -12,6 +12,8 @@ namespace NzbDrone.Core.Notifications.Pushover
return true;
}
}
+
+ public string ApiKey { get; set; }
public string UserKey { get; set; }
public int Priority { get; set; }
}
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index af8e20cee..599e2cdb1 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -189,6 +189,7 @@
+
diff --git a/src/UI/Shared/SignalRBroadcaster.js b/src/UI/Shared/SignalRBroadcaster.js
index 296f81457..419c398da 100644
--- a/src/UI/Shared/SignalRBroadcaster.js
+++ b/src/UI/Shared/SignalRBroadcaster.js
@@ -29,7 +29,6 @@ define(
var tryingToReconnect = false;
var messengerId = 'signalR';
- var reconnectTimeout;
this.signalRconnection = $.connection('/signalr');
@@ -47,19 +46,9 @@ define(
}
tryingToReconnect = true;
-
- reconnectTimeout = window.setTimeout(function () {
- Messenger.show({
- id : messengerId,
- type : 'info',
- hideAfter : 0,
- message : 'Connection to backend lost, attempting to reconnect'
- });
- }, 10000);
});
this.signalRconnection.reconnected(function() {
- window.clearTimeout(reconnectTimeout);
tryingToReconnect = false;
var currentVersion = StatusModel.get('version');