mirror of https://github.com/Radarr/Radarr
ExternalNotification now has AfterRename, to notify (XBMC) after all episodes have been renamed.
This commit is contained in:
parent
7963390126
commit
e734bb6ecb
|
@ -11,15 +11,20 @@ namespace NzbDrone.Core.Jobs
|
|||
{
|
||||
private readonly DiskScanProvider _diskScanProvider;
|
||||
private readonly MediaFileProvider _mediaFileProvider;
|
||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RenameEpisodeJob(DiskScanProvider diskScanProvider, MediaFileProvider mediaFileProvider)
|
||||
public RenameEpisodeJob(DiskScanProvider diskScanProvider, MediaFileProvider mediaFileProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider)
|
||||
{
|
||||
_diskScanProvider = diskScanProvider;
|
||||
_mediaFileProvider = mediaFileProvider;
|
||||
_externalNotificationProvider = externalNotificationProvider;
|
||||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -39,6 +44,12 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
var episode = _mediaFileProvider.GetEpisodeFile(targetId);
|
||||
_diskScanProvider.MoveEpisodeFile(episode);
|
||||
|
||||
//Start AfterRename
|
||||
var series = _seriesProvider.GetSeries(episode.SeriesId);
|
||||
var message = String.Format("Renamed: Series {0}, Season: {1}", series.Title, secondaryTargetId);
|
||||
_externalNotificationProvider.AfterRename(message, series);
|
||||
|
||||
notification.CurrentMessage = String.Format("Episode rename completed for: {0} ", targetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,15 +11,19 @@ namespace NzbDrone.Core.Jobs
|
|||
{
|
||||
private readonly MediaFileProvider _mediaFileProvider;
|
||||
private readonly DiskScanProvider _diskScanProvider;
|
||||
|
||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider)
|
||||
public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider)
|
||||
{
|
||||
_mediaFileProvider = mediaFileProvider;
|
||||
_diskScanProvider = diskScanProvider;
|
||||
_externalNotificationProvider = externalNotificationProvider;
|
||||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -54,6 +58,11 @@ namespace NzbDrone.Core.Jobs
|
|||
_diskScanProvider.MoveEpisodeFile(episodeFile);
|
||||
}
|
||||
|
||||
//Start AfterRename
|
||||
var series = _seriesProvider.GetSeries(targetId);
|
||||
var message = String.Format("Renamed: Series {0}, Season: {1}", series.Title, secondaryTargetId);
|
||||
_externalNotificationProvider.AfterRename(message, series);
|
||||
|
||||
notification.CurrentMessage = String.Format("Season rename completed for Series: {0} Season: {1}", targetId, secondaryTargetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,15 +11,19 @@ namespace NzbDrone.Core.Jobs
|
|||
{
|
||||
private readonly MediaFileProvider _mediaFileProvider;
|
||||
private readonly DiskScanProvider _diskScanProvider;
|
||||
|
||||
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RenameSeriesJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider)
|
||||
public RenameSeriesJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider)
|
||||
{
|
||||
_mediaFileProvider = mediaFileProvider;
|
||||
_diskScanProvider = diskScanProvider;
|
||||
_externalNotificationProvider = externalNotificationProvider;
|
||||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -51,6 +55,11 @@ namespace NzbDrone.Core.Jobs
|
|||
_diskScanProvider.MoveEpisodeFile(episodeFile);
|
||||
}
|
||||
|
||||
//Start AfterRename
|
||||
var series = _seriesProvider.GetSeries(targetId);
|
||||
var message = String.Format("Renamed: Series {0}", series.Title);
|
||||
_externalNotificationProvider.AfterRename(message, series);
|
||||
|
||||
notification.CurrentMessage = String.Format("Series rename completed for Series: {0}", targetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,5 +41,12 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
/// <param name = "message">The message to send to the receiver</param>
|
||||
/// <param name = "series">The Series for the new download</param>
|
||||
public abstract void OnRename(string message, Series series);
|
||||
|
||||
/// <summary>
|
||||
/// Performs the after rename action, this will be handled after all renaming for episode/season/series
|
||||
/// </summary>
|
||||
/// <param name = "message">The message to send to the receiver</param>
|
||||
/// <param name = "series">The Series for the new download</param>
|
||||
public abstract void AfterRename(string message, Series series);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,5 +70,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,5 +69,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,5 +47,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,12 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,11 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|||
}
|
||||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
UpdateAndClean(series);
|
||||
}
|
||||
|
|
|
@ -108,5 +108,13 @@ namespace NzbDrone.Core.Providers
|
|||
notifier.OnRename(message, series);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void AfterRename(string message, Series series)
|
||||
{
|
||||
foreach (var notifier in _notifiers.Where(i => GetSettings(i.GetType()).Enable))
|
||||
{
|
||||
notifier.OnRename(message, series);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue