diff --git a/NzbDrone.Core/Jobs/RenameEpisodeJob.cs b/NzbDrone.Core/Jobs/RenameEpisodeJob.cs
index f998b3e17..cab50ac41 100644
--- a/NzbDrone.Core/Jobs/RenameEpisodeJob.cs
+++ b/NzbDrone.Core/Jobs/RenameEpisodeJob.cs
@@ -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);
}
}
diff --git a/NzbDrone.Core/Jobs/RenameSeasonJob.cs b/NzbDrone.Core/Jobs/RenameSeasonJob.cs
index 1aef4544f..74dd08962 100644
--- a/NzbDrone.Core/Jobs/RenameSeasonJob.cs
+++ b/NzbDrone.Core/Jobs/RenameSeasonJob.cs
@@ -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);
}
}
diff --git a/NzbDrone.Core/Jobs/RenameSeriesJob.cs b/NzbDrone.Core/Jobs/RenameSeriesJob.cs
index 47144fe00..19aadfcc1 100644
--- a/NzbDrone.Core/Jobs/RenameSeriesJob.cs
+++ b/NzbDrone.Core/Jobs/RenameSeriesJob.cs
@@ -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);
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/ExternalNotificationBase.cs b/NzbDrone.Core/Providers/ExternalNotification/ExternalNotificationBase.cs
index 811713e22..43fe7bec3 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/ExternalNotificationBase.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/ExternalNotificationBase.cs
@@ -41,5 +41,12 @@ namespace NzbDrone.Core.Providers.ExternalNotification
/// The message to send to the receiver
/// The Series for the new download
public abstract void OnRename(string message, Series series);
+
+ ///
+ /// Performs the after rename action, this will be handled after all renaming for episode/season/series
+ ///
+ /// The message to send to the receiver
+ /// The Series for the new download
+ public abstract void AfterRename(string message, Series series);
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/Growl.cs b/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
index 03de0d9f0..5d7701a24 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
@@ -70,5 +70,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
{
}
+
+ public override void AfterRename(string message, Series series)
+ {
+
+ }
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs b/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs
index 0bb79fd3f..987d3c185 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Prowl.cs
@@ -69,5 +69,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
{
}
+
+ public override void AfterRename(string message, Series series)
+ {
+
+ }
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/Smtp.cs b/NzbDrone.Core/Providers/ExternalNotification/Smtp.cs
index 33287a053..c3bda14c2 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Smtp.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Smtp.cs
@@ -47,5 +47,10 @@ namespace NzbDrone.Core.Providers.ExternalNotification
{
}
+
+ public override void AfterRename(string message, Series series)
+ {
+
+ }
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/Twitter.cs b/NzbDrone.Core/Providers/ExternalNotification/Twitter.cs
index 79fae1a9a..83e85b302 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Twitter.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Twitter.cs
@@ -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)
+ {
+
}
}
}
diff --git a/NzbDrone.Core/Providers/ExternalNotification/Xbmc.cs b/NzbDrone.Core/Providers/ExternalNotification/Xbmc.cs
index 2533fc54e..013818835 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Xbmc.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Xbmc.cs
@@ -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);
}
diff --git a/NzbDrone.Core/Providers/ExternalNotificationProvider.cs b/NzbDrone.Core/Providers/ExternalNotificationProvider.cs
index 749c12875..1016deb25 100644
--- a/NzbDrone.Core/Providers/ExternalNotificationProvider.cs
+++ b/NzbDrone.Core/Providers/ExternalNotificationProvider.cs
@@ -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);
+ }
+ }
}
}
\ No newline at end of file