mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Use a list for ChannelTags and DeviceIds in Pushbullet settings
This commit is contained in:
parent
461be2b388
commit
370406c3de
8 changed files with 157 additions and 35 deletions
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Rest;
|
||||
|
||||
|
@ -28,13 +26,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
|||
|
||||
public void SendNotification(string title, string message, PushBulletSettings settings)
|
||||
{
|
||||
var channelTags = GetIds(settings.ChannelTags);
|
||||
var deviceIds = GetIds(settings.DeviceIds);
|
||||
var error = false;
|
||||
|
||||
if (channelTags.Any())
|
||||
if (settings.ChannelTags.Any())
|
||||
{
|
||||
foreach (var channelTag in channelTags)
|
||||
foreach (var channelTag in settings.ChannelTags)
|
||||
{
|
||||
var request = BuildChannelRequest(channelTag);
|
||||
|
||||
|
@ -51,9 +47,9 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
|||
}
|
||||
else
|
||||
{
|
||||
if (deviceIds.Any())
|
||||
if (settings.DeviceIds.Any())
|
||||
{
|
||||
foreach (var deviceId in deviceIds)
|
||||
foreach (var deviceId in settings.DeviceIds)
|
||||
{
|
||||
var request = BuildDeviceRequest(deviceId);
|
||||
|
||||
|
@ -169,12 +165,5 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
|||
throw new PushBulletException("Unable to send text message: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetIds(string input)
|
||||
{
|
||||
if (input.IsNullOrWhiteSpace()) return new List<string>();
|
||||
|
||||
return input.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue