Merge pull request #1100 from IvanBrazza/develop

Pushbullet: Source device support
This commit is contained in:
Mark McDowall 2016-01-28 14:49:47 -08:00
commit 9895b5bc1d
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ using FluentValidation.Results;
using NLog; using NLog;
using RestSharp; using RestSharp;
using NzbDrone.Core.Rest; using NzbDrone.Core.Rest;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.Notifications.PushBullet namespace NzbDrone.Core.Notifications.PushBullet
{ {
@ -151,6 +152,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
request.AddParameter("title", title); request.AddParameter("title", title);
request.AddParameter("body", message); request.AddParameter("body", message);
if (settings.SenderId.IsNotNullOrWhiteSpace())
{
request.AddParameter("source_device_iden", settings.SenderId);
}
client.Authenticator = new HttpBasicAuthenticator(settings.ApiKey, string.Empty); client.Authenticator = new HttpBasicAuthenticator(settings.ApiKey, string.Empty);
client.ExecuteAndValidate(request); client.ExecuteAndValidate(request);
} }

View File

@ -33,6 +33,9 @@ namespace NzbDrone.Core.Notifications.PushBullet
[FieldDefinition(2, Label = "Channel Tags", HelpText = "List of Channel Tags to send notifications to", Type = FieldType.Tag)] [FieldDefinition(2, Label = "Channel Tags", HelpText = "List of Channel Tags to send notifications to", Type = FieldType.Tag)]
public IEnumerable<string> ChannelTags { get; set; } public IEnumerable<string> ChannelTags { get; set; }
[FieldDefinition(3, Label = "Sender ID", HelpText = "The device ID to send notifications from, use device_iden in the device's URL on pushbullet.com (leave blank to send from yourself)")]
public string SenderId { get; set; }
public NzbDroneValidationResult Validate() public NzbDroneValidationResult Validate()
{ {
return new NzbDroneValidationResult(Validator.Validate(this)); return new NzbDroneValidationResult(Validator.Validate(this));