mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Fixed: Don't re-read file tags if possible
This commit is contained in:
parent
e9ced07b28
commit
dcca2b5a1a
1 changed files with 15 additions and 12 deletions
|
@ -173,17 +173,19 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Identification
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LocalTrack> ToLocalTrack(IEnumerable<TrackFile> trackfiles)
|
private List<LocalTrack> ToLocalTrack(IEnumerable<TrackFile> trackfiles, LocalAlbumRelease localRelease)
|
||||||
{
|
{
|
||||||
var localTracks = trackfiles.Select(x => new LocalTrack {
|
var scanned = trackfiles.Join(localRelease.LocalTracks, t => t.Path, l => l.Path, (track, localTrack) => localTrack);
|
||||||
Path = x.Path,
|
var toScan = trackfiles.ExceptBy(t => t.Path, scanned, s => s.Path, StringComparer.InvariantCulture);
|
||||||
Size = x.Size,
|
var localTracks = scanned.Concat(toScan.Select(x => new LocalTrack {
|
||||||
Modified = x.Modified,
|
Path = x.Path,
|
||||||
FileTrackInfo = _audioTagService.ReadTags(x.Path),
|
Size = x.Size,
|
||||||
ExistingFile = true,
|
Modified = x.Modified,
|
||||||
AdditionalFile = true,
|
FileTrackInfo = _audioTagService.ReadTags(x.Path),
|
||||||
Quality = x.Quality
|
ExistingFile = true,
|
||||||
})
|
AdditionalFile = true,
|
||||||
|
Quality = x.Quality
|
||||||
|
}))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
localTracks.ForEach(x => _augmentingService.Augment(x, true));
|
localTracks.ForEach(x => _augmentingService.Augment(x, true));
|
||||||
|
@ -218,7 +220,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Identification
|
||||||
// convert all the TrackFiles that represent extra files to List<LocalTrack>
|
// convert all the TrackFiles that represent extra files to List<LocalTrack>
|
||||||
var allLocalTracks = ToLocalTrack(candidateReleases
|
var allLocalTracks = ToLocalTrack(candidateReleases
|
||||||
.SelectMany(x => x.ExistingTracks)
|
.SelectMany(x => x.ExistingTracks)
|
||||||
.DistinctBy(x => x.Path));
|
.DistinctBy(x => x.Path), localAlbumRelease);
|
||||||
|
|
||||||
_logger.Debug($"Retrieved {allTracks.Count} possible tracks in {watch.ElapsedMilliseconds}ms");
|
_logger.Debug($"Retrieved {allTracks.Count} possible tracks in {watch.ElapsedMilliseconds}ms");
|
||||||
|
|
||||||
|
@ -242,7 +244,8 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Identification
|
||||||
allLocalTracks.AddRange(ToLocalTrack(newCandidates
|
allLocalTracks.AddRange(ToLocalTrack(newCandidates
|
||||||
.SelectMany(x => x.ExistingTracks)
|
.SelectMany(x => x.ExistingTracks)
|
||||||
.DistinctBy(x => x.Path)
|
.DistinctBy(x => x.Path)
|
||||||
.ExceptBy(x => x.Path, allLocalTracks, x => x.Path, PathEqualityComparer.Instance)));
|
.ExceptBy(x => x.Path, allLocalTracks, x => x.Path, PathEqualityComparer.Instance),
|
||||||
|
localAlbumRelease));
|
||||||
}
|
}
|
||||||
|
|
||||||
// fingerprint all the local files in candidates we might be matching against
|
// fingerprint all the local files in candidates we might be matching against
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue