mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
Disk scan is much much much much faster.
This commit is contained in:
parent
c21ff235b6
commit
b676f868ce
10 changed files with 112 additions and 81 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue