From 9714186243835b274ec78a4bf51053cf79e3a863 Mon Sep 17 00:00:00 2001 From: ta264 Date: Wed, 30 Sep 2020 22:37:45 +0100 Subject: [PATCH] Fixed: Create album metadata on import --- src/NzbDrone.Core/Extras/Metadata/MetadataService.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs index 56158403b..a9912ee16 100644 --- a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs +++ b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs @@ -104,12 +104,12 @@ namespace NzbDrone.Core.Extras.Metadata files.AddIfNotNull(ProcessArtistMetadata(consumer, artist, consumerFiles)); files.AddRange(ProcessArtistImages(consumer, artist, consumerFiles)); - var albumGroups = trackFiles.GroupBy(s => Path.GetDirectoryName(s.Path)).ToList(); + var albumGroups = trackFiles.GroupBy(s => s.AlbumId).ToList(); foreach (var group in albumGroups) { - var album = _albumService.GetAlbum(group.First().AlbumId); - var albumFolder = group.Key; + var album = _albumService.GetAlbum(group.Key); + var albumFolder = Path.GetDirectoryName(group.First().Path); files.AddIfNotNull(ProcessAlbumMetadata(consumer, artist, album, albumFolder, consumerFiles)); files.AddRange(ProcessAlbumImages(consumer, artist, album, albumFolder, consumerFiles)); @@ -159,6 +159,12 @@ namespace NzbDrone.Core.Extras.Metadata files.AddIfNotNull(ProcessArtistMetadata(consumer, artist, consumerFiles)); files.AddRange(ProcessArtistImages(consumer, artist, consumerFiles)); } + + if (albumFolder.IsNotNullOrWhiteSpace()) + { + files.AddIfNotNull(ProcessAlbumMetadata(consumer, artist, album, albumFolder, consumerFiles)); + files.AddRange(ProcessAlbumImages(consumer, artist, album, albumFolder, consumerFiles)); + } } _metadataFileService.Upsert(files);