mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
New: Added Plex to Notifications, allowing notifications and library updates.
This commit is contained in:
parent
d27f14d7aa
commit
6e767eafab
12 changed files with 629 additions and 74 deletions
66
NzbDrone.Core/Providers/ExternalNotification/Plex.cs
Normal file
66
NzbDrone.Core/Providers/ExternalNotification/Plex.cs
Normal file
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers.ExternalNotification
|
||||
{
|
||||
public class Plex : ExternalNotificationBase
|
||||
{
|
||||
private readonly PlexProvider _plexProvider;
|
||||
|
||||
public Plex(ConfigProvider configProvider, PlexProvider plexProvider)
|
||||
: base(configProvider)
|
||||
{
|
||||
_plexProvider = plexProvider;
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "Plex"; }
|
||||
}
|
||||
|
||||
public override void OnGrab(string message)
|
||||
{
|
||||
const string header = "NzbDrone [TV] - Grabbed";
|
||||
|
||||
if (_configProvider.PlexNotifyOnGrab)
|
||||
{
|
||||
_logger.Trace("Sending Notification to Plex Clients");
|
||||
_plexProvider.Notify(header, message);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDownload(string message, Series series)
|
||||
{
|
||||
const string header = "NzbDrone [TV] - Downloaded";
|
||||
|
||||
if (_configProvider.PlexNotifyOnDownload)
|
||||
{
|
||||
_logger.Trace("Sending Notification to Plex Clients");
|
||||
_plexProvider.Notify(header, message);
|
||||
}
|
||||
|
||||
UpdateIfEnabled();
|
||||
}
|
||||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
UpdateIfEnabled();
|
||||
}
|
||||
|
||||
private void UpdateIfEnabled()
|
||||
{
|
||||
if (_configProvider.PlexUpdateLibrary)
|
||||
{
|
||||
_logger.Trace("Sending Update Request to Plex Server");
|
||||
_plexProvider.UpdateLibrary();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue