Lidarr/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowser.cs

65 lines
1.7 KiB
C#
Raw Normal View History

2014-08-03 07:26:55 +00:00
using System;
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Notifications.MediaBrowser
{
public class MediaBrowser : NotificationBase<MediaBrowserSettings>
{
private readonly IMediaBrowserService _mediaBrowserService;
public MediaBrowser(IMediaBrowserService mediaBrowserService)
{
_mediaBrowserService = mediaBrowserService;
}
2016-12-09 06:54:15 +00:00
public override string Link => "http://mediabrowser.tv/";
2014-08-03 07:26:55 +00:00
public override void OnGrab(GrabMessage grabMessage)
2014-08-03 07:26:55 +00:00
{
const string title = "Sonarr - Grabbed";
if (Settings.Notify)
{
_mediaBrowserService.Notify(Settings, title, grabMessage.Message);
2014-08-03 07:26:55 +00:00
}
}
public override void OnDownload(DownloadMessage message)
{
const string title = "Sonarr - Downloaded";
if (Settings.Notify)
{
_mediaBrowserService.Notify(Settings, title, message.Message);
}
if (Settings.UpdateLibrary)
{
_mediaBrowserService.Update(Settings, message.Series);
}
}
public override void OnRename(Series series)
2014-08-03 07:26:55 +00:00
{
if (Settings.UpdateLibrary)
{
_mediaBrowserService.Update(Settings, series);
}
}
2016-12-09 06:54:15 +00:00
public override string Name => "Emby (Media Browser)";
2015-04-25 16:02:17 +00:00
2014-08-03 07:26:55 +00:00
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();
failures.AddIfNotNull(_mediaBrowserService.Test(Settings));
return new ValidationResult(failures);
}
}
}