|
|
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
var successCount = 0;
|
|
|
|
var successCount = 0;
|
|
|
|
var failCount = 0;
|
|
|
|
var failCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var existinEpisodes = _episodeService.GetEpisodeBySeries(series.Id);
|
|
|
|
var existingEpisodes = _episodeService.GetEpisodeBySeries(series.Id);
|
|
|
|
var seasons = _seasonService.GetSeasonsBySeries(series.Id);
|
|
|
|
var seasons = _seasonService.GetSeasonsBySeries(series.Id);
|
|
|
|
|
|
|
|
|
|
|
|
var updateList = new List<Episode>();
|
|
|
|
var updateList = new List<Episode>();
|
|
|
@ -44,11 +44,11 @@ namespace NzbDrone.Core.Tv
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var episodeToUpdate = existinEpisodes.SingleOrDefault(e => e.SeasonNumber == episode.SeasonNumber && e.EpisodeNumber == episode.EpisodeNumber);
|
|
|
|
var episodeToUpdate = existingEpisodes.SingleOrDefault(e => e.SeasonNumber == episode.SeasonNumber && e.EpisodeNumber == episode.EpisodeNumber);
|
|
|
|
|
|
|
|
|
|
|
|
if (episodeToUpdate != null)
|
|
|
|
if (episodeToUpdate != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
existinEpisodes.Remove(episodeToUpdate);
|
|
|
|
existingEpisodes.Remove(episodeToUpdate);
|
|
|
|
updateList.Add(episodeToUpdate);
|
|
|
|
updateList.Add(episodeToUpdate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -82,11 +82,10 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
|
|
|
|
|
|
|
AdjustMultiEpisodeAirTime(series, allEpisodes);
|
|
|
|
AdjustMultiEpisodeAirTime(series, allEpisodes);
|
|
|
|
|
|
|
|
|
|
|
|
_episodeService.DeleteMany(existinEpisodes);
|
|
|
|
_episodeService.DeleteMany(existingEpisodes);
|
|
|
|
_episodeService.UpdateMany(updateList);
|
|
|
|
_episodeService.UpdateMany(updateList);
|
|
|
|
_episodeService.InsertMany(newList);
|
|
|
|
_episodeService.InsertMany(newList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (newList.Any())
|
|
|
|
if (newList.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList, series));
|
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList, series));
|
|
|
@ -97,6 +96,11 @@ namespace NzbDrone.Core.Tv
|
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoUpdatedEvent(updateList));
|
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoUpdatedEvent(updateList));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (existingEpisodes.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_messageAggregator.PublishEvent(new EpisodeInfoDeletedEvent(updateList));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (failCount != 0)
|
|
|
|
if (failCount != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ",
|
|
|
|
_logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ",
|
|
|
|