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

56 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 IPlexService _plexService;
2013-05-19 23:17:32 +00:00
public PlexClient(IPlexService plexService)
2013-05-19 23:17:32 +00:00
{
_plexService = plexService;
2013-05-19 23:17:32 +00:00
}
public override string Link
{
get { return "http://www.plexapp.com/"; }
}
2013-05-19 23:17:32 +00:00
public override void OnGrab(string message)
{
2014-11-16 04:11:50 +00:00
const string header = "Sonarr [TV] - Grabbed";
_plexService.Notify(Settings, header, message);
2013-05-19 23:17:32 +00:00
}
public override void OnDownload(DownloadMessage message)
2013-05-19 23:17:32 +00:00
{
2014-11-16 04:11:50 +00:00
const string header = "Sonarr [TV] - Downloaded";
_plexService.Notify(Settings, header, message.Message);
2013-05-19 23:17:32 +00:00
}
public override void AfterRename(Series series)
{
}
2015-04-25 16:02:17 +00:00
public override string Name
{
get
{
return "Plex Media Center";
}
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();
failures.AddIfNotNull(_plexService.Test(Settings));
return new ValidationResult(failures);
}
2013-05-19 23:17:32 +00:00
}
}