Added EpisodesChanged to signalR series event to notify that episode monitored flag may have changed
This commit is contained in:
parent
e8f58eb9be
commit
32f2d417d3
|
@ -6,11 +6,13 @@ namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
public Series Series { get; private set; }
|
public Series Series { get; private set; }
|
||||||
public Series OldSeries { get; private set; }
|
public Series OldSeries { get; private set; }
|
||||||
|
public bool EpisodesChanged { get; private set; }
|
||||||
|
|
||||||
public SeriesEditedEvent(Series series, Series oldSeries)
|
public SeriesEditedEvent(Series series, Series oldSeries, bool episodesChanged = false)
|
||||||
{
|
{
|
||||||
Series = series;
|
Series = series;
|
||||||
OldSeries = oldSeries;
|
OldSeries = oldSeries;
|
||||||
|
EpisodesChanged = episodesChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -175,6 +175,8 @@ namespace NzbDrone.Core.Tv
|
||||||
{
|
{
|
||||||
var storedSeries = GetSeries(series.Id);
|
var storedSeries = GetSeries(series.Id);
|
||||||
|
|
||||||
|
var episodeMonitoredChanged = false;
|
||||||
|
|
||||||
if (updateEpisodesToMatchSeason)
|
if (updateEpisodesToMatchSeason)
|
||||||
{
|
{
|
||||||
foreach (var season in series.Seasons)
|
foreach (var season in series.Seasons)
|
||||||
|
@ -184,6 +186,7 @@ namespace NzbDrone.Core.Tv
|
||||||
if (storedSeason != null && season.Monitored != storedSeason.Monitored)
|
if (storedSeason != null && season.Monitored != storedSeason.Monitored)
|
||||||
{
|
{
|
||||||
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
|
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
|
||||||
|
episodeMonitoredChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +197,7 @@ namespace NzbDrone.Core.Tv
|
||||||
var updatedSeries = _seriesRepository.Update(series);
|
var updatedSeries = _seriesRepository.Update(series);
|
||||||
if (publishUpdatedEvent)
|
if (publishUpdatedEvent)
|
||||||
{
|
{
|
||||||
_eventAggregator.PublishEvent(new SeriesEditedEvent(updatedSeries, storedSeries));
|
_eventAggregator.PublishEvent(new SeriesEditedEvent(updatedSeries, storedSeries, episodeMonitoredChanged));
|
||||||
}
|
}
|
||||||
|
|
||||||
return updatedSeries;
|
return updatedSeries;
|
||||||
|
|
|
@ -267,7 +267,9 @@ namespace Sonarr.Api.V3.Series
|
||||||
|
|
||||||
public void Handle(SeriesEditedEvent message)
|
public void Handle(SeriesEditedEvent message)
|
||||||
{
|
{
|
||||||
BroadcastResourceChange(ModelAction.Updated, message.Series.Id);
|
var resource = GetResourceByIdForBroadcast(message.Series.Id);
|
||||||
|
resource.EpisodesChanged = message.EpisodesChanged;
|
||||||
|
BroadcastResourceChange(ModelAction.Updated, resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(SeriesDeletedEvent message)
|
public void Handle(SeriesDeletedEvent message)
|
||||||
|
|
|
@ -64,6 +64,8 @@ namespace Sonarr.Api.V3.Series
|
||||||
public Ratings Ratings { get; set; }
|
public Ratings Ratings { get; set; }
|
||||||
|
|
||||||
public SeriesStatisticsResource Statistics { get; set; }
|
public SeriesStatisticsResource Statistics { get; set; }
|
||||||
|
|
||||||
|
public bool? EpisodesChanged { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SeriesResourceMapper
|
public static class SeriesResourceMapper
|
||||||
|
|
Loading…
Reference in New Issue