No more dupes and house cleaner added

This commit is contained in:
Mark McDowall
2014-01-25 23:14:55 -08:00
parent 3ca5e478ff
commit 409e1cca94
16 changed files with 235 additions and 71 deletions
+11 -4
View File
@@ -1,31 +1,38 @@
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Metadata.Files;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Metadata
{
public class NotificationService
: IHandle<SeriesUpdatedEvent>,
: IHandle<MediaCoversUpdatedEvent>,
IHandle<EpisodeImportedEvent>,
IHandle<SeriesRenamedEvent>
{
private readonly IMetadataFactory _metadataFactory;
private readonly MetadataFileService _metadataFileService;
private readonly Logger _logger;
public NotificationService(IMetadataFactory metadataFactory, Logger logger)
public NotificationService(IMetadataFactory metadataFactory, MetadataFileService metadataFileService, Logger logger)
{
_metadataFactory = metadataFactory;
_metadataFileService = metadataFileService;
_logger = logger;
}
public void Handle(SeriesUpdatedEvent message)
public void Handle(MediaCoversUpdatedEvent message)
{
var seriesMetadata = _metadataFileService.GetFilesBySeries(message.Series.Id);
foreach (var consumer in _metadataFactory.Enabled())
{
consumer.OnSeriesUpdated(message.Series);
consumer.OnSeriesUpdated(message.Series, seriesMetadata.Where(c => c.Consumer == consumer.GetType().Name).ToList());
}
}