mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
Fixed: Prowl notifications priority
This commit is contained in:
parent
67b1fd9bc5
commit
4bf311d820
@ -18,27 +18,27 @@ public Prowl(IProwlProxy prowlProxy)
|
||||
|
||||
public override void OnGrab(GrabMessage grabMessage)
|
||||
{
|
||||
_prowlProxy.SendNotification(MOVIE_GRABBED_TITLE, grabMessage.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
|
||||
_prowlProxy.SendNotification(MOVIE_GRABBED_TITLE, grabMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnDownload(DownloadMessage message)
|
||||
{
|
||||
_prowlProxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
|
||||
_prowlProxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
|
||||
{
|
||||
_prowlProxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
|
||||
_prowlProxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
|
||||
{
|
||||
_prowlProxy.SendNotification(MOVIE_DELETED_TITLE, deleteMessage.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
|
||||
_prowlProxy.SendNotification(MOVIE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnHealthIssue(HealthCheck.HealthCheck message)
|
||||
{
|
||||
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
|
||||
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override ValidationResult Test()
|
||||
|
@ -9,7 +9,7 @@ namespace NzbDrone.Core.Notifications.Prowl
|
||||
{
|
||||
public interface IProwlProxy
|
||||
{
|
||||
void SendNotification(string title, string message, string apiKey, ProwlPriority priority = ProwlPriority.Normal, string url = null);
|
||||
void SendNotification(string title, string message, ProwlSettings settings);
|
||||
ValidationFailure Test(ProwlSettings settings);
|
||||
}
|
||||
|
||||
@ -25,19 +25,18 @@ public ProwlProxy(IHttpClient httpClient, Logger logger)
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void SendNotification(string title, string message, string apiKey, ProwlPriority priority = ProwlPriority.Normal, string url = null)
|
||||
public void SendNotification(string title, string message, ProwlSettings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
var requestBuilder = new HttpRequestBuilder(PUSH_URL);
|
||||
|
||||
var request = requestBuilder.Post()
|
||||
.AddFormParameter("apikey", apiKey)
|
||||
.AddFormParameter("apikey", settings.ApiKey)
|
||||
.AddFormParameter("application", BuildInfo.AppName)
|
||||
.AddFormParameter("event", title)
|
||||
.AddFormParameter("description", message)
|
||||
.AddFormParameter("priority", priority)
|
||||
.AddFormParameter("url", url)
|
||||
.AddFormParameter("priority", settings.Priority)
|
||||
.Build();
|
||||
|
||||
_httpClient.Post(request);
|
||||
@ -46,7 +45,7 @@ public void SendNotification(string title, string message, string apiKey, ProwlP
|
||||
{
|
||||
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
_logger.Error(ex, "Apikey is invalid: {0}", apiKey);
|
||||
_logger.Error(ex, "Apikey is invalid: {0}", settings.ApiKey);
|
||||
throw new ProwlException("Apikey is invalid", ex);
|
||||
}
|
||||
|
||||
@ -65,7 +64,7 @@ public ValidationFailure Test(ProwlSettings settings)
|
||||
const string title = "Test Notification";
|
||||
const string body = "This is a test message from Radarr";
|
||||
|
||||
SendNotification(title, body, settings.ApiKey);
|
||||
SendNotification(title, body, settings);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user