mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
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 @@ public class RenameEpisodeJob : IJob
|
||||
{
|
||||
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 @@ public void Start(ProgressNotification notification, int targetId, int secondary
|
||||
|
||||
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 @@ public class RenameSeasonJob : IJob
|
||||
{
|
||||
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 @@ public void Start(ProgressNotification notification, int targetId, int secondary
|
||||
_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 @@ public class RenameSeriesJob : IJob
|
||||
{
|
||||
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 @@ public void Start(ProgressNotification notification, int targetId, int secondary
|
||||
_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 @@ protected ExternalNotificationBase(ConfigProvider configProvider)
|
||||
/// <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 @@ public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +69,10 @@ public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,5 +47,10 @@ public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,12 @@ public override void OnDownload(string message, Series series)
|
||||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,11 @@ public override void OnDownload(string message, Series series)
|
||||
}
|
||||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterRename(string message, Series series)
|
||||
{
|
||||
UpdateAndClean(series);
|
||||
}
|
||||
|
@ -108,5 +108,13 @@ public virtual void OnRename(string message, Series series)
|
||||
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
Block a user