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:
parent
0f50a45714
commit
24e72d3d0f
1 changed files with 20 additions and 1 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue