1
0
Fork 0
mirror of https://github.com/fiso64/slsk-batchdl.git synced 2025-01-23 05:00:35 +00:00

improve album search performance

This commit is contained in:
fiso64 2024-12-24 14:42:25 +01:00
parent 55571f4156
commit 91c70fcfcd

View file

@ -341,21 +341,38 @@ static class Search
}
}
foreach ((var key, var val) in directoryStructure)
var sortedKeys = directoryStructure.Keys.OrderBy(key => key).ToList();
var toRemove = new HashSet<string>();
for (int i = 0; i < sortedKeys.Count; i++)
{
foreach ((var key2, var val2) in directoryStructure)
var key = sortedKeys[i];
if (toRemove.Contains(key))
continue;
for (int j = i + 1; j < sortedKeys.Count; j++)
{
if (key == key2)
var key2 = sortedKeys[j];
if (toRemove.Contains(key2))
continue;
if ((key2 + '\\').StartsWith(key + '\\'))
{
val.AddRange(val2);
directoryStructure.Remove(key2);
directoryStructure[key].AddRange(directoryStructure[key2]);
toRemove.Add(key2);
}
else if (!(key2 + '\\').StartsWith(key))
{
break;
}
}
}
foreach (var key in toRemove)
{
directoryStructure.Remove(key);
}
int min, max;
if (config.minAlbumTrackCount > -1 || config.maxAlbumTrackCount > -1)
{