mirror of https://github.com/lidarr/Lidarr
83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using FluentValidation.Results;
|
|
using NzbDrone.Common.Extensions;
|
|
using NzbDrone.Core.Music;
|
|
|
|
namespace NzbDrone.Core.Notifications.Emby
|
|
{
|
|
public class MediaBrowser : NotificationBase<MediaBrowserSettings>
|
|
{
|
|
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, ALBUM_GRABBED_TITLE_BRANDED, grabMessage.Message);
|
|
}
|
|
}
|
|
|
|
public override void OnReleaseImport(AlbumDownloadMessage message)
|
|
{
|
|
if (Settings.Notify)
|
|
{
|
|
_mediaBrowserService.Notify(Settings, ALBUM_DOWNLOADED_TITLE_BRANDED, message.Message);
|
|
}
|
|
|
|
if (Settings.UpdateLibrary)
|
|
{
|
|
_mediaBrowserService.Update(Settings, message.Artist);
|
|
}
|
|
}
|
|
|
|
public override void OnRename(Artist artist)
|
|
{
|
|
if (Settings.UpdateLibrary)
|
|
{
|
|
_mediaBrowserService.Update(Settings, artist);
|
|
}
|
|
}
|
|
|
|
public override void OnHealthIssue(HealthCheck.HealthCheck message)
|
|
{
|
|
if (Settings.Notify)
|
|
{
|
|
_mediaBrowserService.Notify(Settings, HEALTH_ISSUE_TITLE_BRANDED, message.Message);
|
|
}
|
|
}
|
|
|
|
public override void OnTrackRetag(TrackRetagMessage message)
|
|
{
|
|
if (Settings.Notify)
|
|
{
|
|
_mediaBrowserService.Notify(Settings, TRACK_RETAGGED_TITLE_BRANDED, message.Message);
|
|
}
|
|
}
|
|
|
|
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
|
|
{
|
|
if (Settings.Notify)
|
|
{
|
|
_mediaBrowserService.Notify(Settings, APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message);
|
|
}
|
|
}
|
|
|
|
public override ValidationResult Test()
|
|
{
|
|
var failures = new List<ValidationFailure>();
|
|
|
|
failures.AddIfNotNull(_mediaBrowserService.Test(Settings));
|
|
|
|
return new ValidationResult(failures);
|
|
}
|
|
}
|
|
}
|