mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-29 02:57:15 +02:00
New: Added priority levels to Join Notifications
This commit is contained in:
parent
0d95873a05
commit
df593f486f
11
src/NzbDrone.Core/Notifications/Join/JoinPriority.cs
Normal file
11
src/NzbDrone.Core/Notifications/Join/JoinPriority.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace NzbDrone.Core.Notifications.Join
|
||||
{
|
||||
public enum JoinPriority
|
||||
{
|
||||
Silent = -2,
|
||||
Quiet = -1,
|
||||
Normal = 0,
|
||||
High = 1,
|
||||
Emergency = 2
|
||||
}
|
||||
}
|
@ -94,6 +94,7 @@ private void SendNotification(string title, string message, RestRequest request,
|
||||
request.AddParameter("text", message);
|
||||
request.AddParameter("icon", "https://cdn.rawgit.com/Sonarr/Sonarr/develop/Logo/256.png"); // Use the Sonarr logo.
|
||||
request.AddParameter("smallicon", "https://cdn.rawgit.com/Sonarr/Sonarr/develop/Logo/96-Outline-White.png"); // 96x96px with outline at 88x88px on a transparent background.
|
||||
request.AddParameter("priority", settings.Priority);
|
||||
|
||||
var response = client.ExecuteAndValidate(request);
|
||||
var res = Json.Deserialize<JoinResponseModel>(response.Content);
|
||||
|
@ -16,6 +16,12 @@ public JoinSettingsValidator()
|
||||
|
||||
public class JoinSettings : IProviderConfig
|
||||
{
|
||||
|
||||
public JoinSettings()
|
||||
{
|
||||
Priority = (int)JoinPriority.Normal;
|
||||
}
|
||||
|
||||
private static readonly JoinSettingsValidator Validator = new JoinSettingsValidator();
|
||||
|
||||
[FieldDefinition(0, Label = "API Key", HelpText = "The API Key from your Join account settings (click Join API button).", HelpLink = "https://joinjoaomgcd.appspot.com/")]
|
||||
@ -27,6 +33,9 @@ public class JoinSettings : IProviderConfig
|
||||
[FieldDefinition(2, Label = "Device Names", HelpText = "Comma separated list of full or partial device names you'd like to send notifications to. If unset, all devices will receive notifications.", HelpLink = "https://joaoapps.com/join/api/")]
|
||||
public string DeviceNames { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "Notification Priority", Type = FieldType.Select, SelectOptions = typeof(JoinPriority))]
|
||||
public int Priority { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
|
@ -911,6 +911,7 @@
|
||||
<Compile Include="MetadataSource\ISearchForNewSeries.cs" />
|
||||
<Compile Include="Notifications\Join\JoinAuthException.cs" />
|
||||
<Compile Include="Notifications\Join\JoinInvalidDeviceException.cs" />
|
||||
<Compile Include="Notifications\Join\JoinPriority.cs" />
|
||||
<Compile Include="Notifications\Join\JoinResponseModel.cs" />
|
||||
<Compile Include="Notifications\Join\Join.cs" />
|
||||
<Compile Include="Notifications\Join\JoinException.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user