using System.Collections.Generic; using FluentValidation.Results; using NzbDrone.Common.Extensions; using NzbDrone.Core.Tv; namespace NzbDrone.Core.Notifications.Emby { public class MediaBrowser : NotificationBase { private readonly IMediaBrowserService _mediaBrowserService; public MediaBrowser(IMediaBrowserService mediaBrowserService) { _mediaBrowserService = mediaBrowserService; } public override string Link => "https://emby.media/"; public override string Name => "Emby (Media Browser)"; public override void OnGrab(GrabMessage grabMessage) { if (Settings.Notify) { _mediaBrowserService.Notify(Settings, EPISODE_GRABBED_TITLE_BRANDED, grabMessage.Message); } } public override void OnDownload(DownloadMessage message) { if (Settings.Notify) { _mediaBrowserService.Notify(Settings, EPISODE_DOWNLOADED_TITLE_BRANDED, message.Message); } if (Settings.UpdateLibrary) { _mediaBrowserService.Update(Settings, message.Series); } } public override void OnRename(Series series) { if (Settings.UpdateLibrary) { _mediaBrowserService.Update(Settings, series); } } public override ValidationResult Test() { var failures = new List(); failures.AddIfNotNull(_mediaBrowserService.Test(Settings)); return new ValidationResult(failures); } } }