1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-01-20 13:49:56 +00:00

Fixed: Don't import duplicate NFO extra files

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
Qstick 2019-09-10 22:02:28 -04:00
parent 0f50a45714
commit 24e72d3d0f

View file

@ -74,9 +74,28 @@ public void ImportExtraFiles(LocalTrack localTrack, TrackFile trackFile, bool is
.Select(e => e.Trim(' ', '.'))
.ToList();
var matchingFilenames = files.Where(f => Path.GetFileNameWithoutExtension(f).StartsWith(sourceFileName, StringComparison.InvariantCultureIgnoreCase));
var matchingFilenames = files.Where(f => Path.GetFileNameWithoutExtension(f).StartsWith(sourceFileName, StringComparison.InvariantCultureIgnoreCase)).ToList();
var filteredFilenames = new List<string>();
var hasNfo = false;
foreach (var matchingFilename in matchingFilenames)
{
// Filter out duplicate NFO files
if (matchingFilename.EndsWith(".nfo", StringComparison.InvariantCultureIgnoreCase))
{
if (hasNfo)
{
continue;
}
hasNfo = true;
}
filteredFilenames.Add(matchingFilename);
}
foreach (var matchingFilename in filteredFilenames)
{
var matchingExtension = wantedExtensions.FirstOrDefault(e => matchingFilename.EndsWith(e));