Radarr/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs

49 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Tv;
2013-05-19 23:17:32 +00:00
namespace NzbDrone.Core.Notifications.Plex
{
2013-05-20 02:43:22 +00:00
public class PlexClient : NotificationBase<PlexClientSettings>
2013-05-19 23:17:32 +00:00
{
private readonly IPlexClientService _plexClientService;
2013-05-19 23:17:32 +00:00
public PlexClient(IPlexClientService plexClientService)
2013-05-19 23:17:32 +00:00
{
_plexClientService = plexClientService;
2013-05-19 23:17:32 +00:00
}
2016-12-09 06:54:15 +00:00
public override string Link => "http://www.plexapp.com/";
public override void OnGrab(GrabMessage grabMessage)
2013-05-19 23:17:32 +00:00
{
const string header = "Radarr [TV] - Grabbed";
_plexClientService.Notify(Settings, header, grabMessage.Message);
2013-05-19 23:17:32 +00:00
}
public override void OnDownload(DownloadMessage message)
2013-05-19 23:17:32 +00:00
{
const string header = "Radarr [TV] - Downloaded";
_plexClientService.Notify(Settings, header, message.Message);
2013-05-19 23:17:32 +00:00
}
public override void OnRename(Series series)
2013-05-19 23:17:32 +00:00
{
}
2016-12-09 06:54:15 +00:00
public override string Name => "Plex Media Center";
2015-04-25 16:02:17 +00:00
2016-12-09 06:54:15 +00:00
public override bool SupportsOnRename => false;
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();
failures.AddIfNotNull(_plexClientService.Test(Settings));
return new ValidationResult(failures);
}
2013-05-19 23:17:32 +00:00
}
}