mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Disk scan is much much much much faster.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Configuration;
|
||||
@@ -15,6 +17,8 @@ namespace NzbDrone.Core.MediaFiles
|
||||
bool Exists(string path);
|
||||
EpisodeFile GetFileByPath(string path);
|
||||
List<EpisodeFile> GetFilesBySeries(int seriesId);
|
||||
|
||||
List<string> FilterExistingFiles(List<string> files, int seriesId);
|
||||
}
|
||||
|
||||
public class MediaFileService : IMediaFileService, IHandleAsync<SeriesDeletedEvent>
|
||||
@@ -65,6 +69,15 @@ namespace NzbDrone.Core.MediaFiles
|
||||
return _mediaFileRepository.GetFilesBySeries(seriesId);
|
||||
}
|
||||
|
||||
public List<string> FilterExistingFiles(List<string> files, int seriesId)
|
||||
{
|
||||
var seriesFiles = GetFilesBySeries(seriesId);
|
||||
|
||||
if (!seriesFiles.Any()) return files;
|
||||
|
||||
return files.Select(f => f.Normalize()).Except(seriesFiles.Select(c => c.Path)).ToList();
|
||||
}
|
||||
|
||||
public void HandleAsync(SeriesDeletedEvent message)
|
||||
{
|
||||
var files = GetFilesBySeries(message.Series.Id);
|
||||
|
Reference in New Issue
Block a user