From fbe6bfc78ecf454df568f6e0b6514d251b6fb2c1 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 17 Sep 2017 23:20:36 -0400 Subject: [PATCH] Add Album Label Support from Metadata --- frontend/src/Episode/EpisodeDetailsModalContent.js | 2 +- frontend/src/Episode/Summary/EpisodeAiring.js | 2 +- frontend/src/Episode/Summary/EpisodeSummary.js | 2 +- src/Lidarr.Api.V3/Albums/AlbumResource.cs | 2 +- src/NzbDrone.Api/Albums/AlbumResource.cs | 2 +- .../MetadataSource/SkyHook/Resource/AlbumResource.cs | 4 ++-- src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs | 1 + src/NzbDrone.Core/Music/Album.cs | 4 ++-- src/NzbDrone.Core/Music/RefreshAlbumService.cs | 3 ++- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/Episode/EpisodeDetailsModalContent.js b/frontend/src/Episode/EpisodeDetailsModalContent.js index 7b0c9d4ba..15381fa20 100644 --- a/frontend/src/Episode/EpisodeDetailsModalContent.js +++ b/frontend/src/Episode/EpisodeDetailsModalContent.js @@ -175,7 +175,7 @@ EpisodeDetailsModalContent.propTypes = { nameSlug: PropTypes.string.isRequired, artistMonitored: PropTypes.bool.isRequired, releaseDate: PropTypes.string.isRequired, - albumLabel: PropTypes.string.isRequired, + albumLabel: PropTypes.arrayOf(PropTypes.string).isRequired, episodeTitle: PropTypes.string.isRequired, monitored: PropTypes.bool.isRequired, isSaving: PropTypes.bool, diff --git a/frontend/src/Episode/Summary/EpisodeAiring.js b/frontend/src/Episode/Summary/EpisodeAiring.js index 6ec8d887b..4d3e10137 100644 --- a/frontend/src/Episode/Summary/EpisodeAiring.js +++ b/frontend/src/Episode/Summary/EpisodeAiring.js @@ -75,7 +75,7 @@ function EpisodeAiring(props) { EpisodeAiring.propTypes = { releaseDate: PropTypes.string.isRequired, - albumLabel: PropTypes.string.isRequired, + albumLabel: PropTypes.arrayOf(PropTypes.string).isRequired, shortDateFormat: PropTypes.string.isRequired, showRelativeDates: PropTypes.bool.isRequired, timeFormat: PropTypes.string.isRequired diff --git a/frontend/src/Episode/Summary/EpisodeSummary.js b/frontend/src/Episode/Summary/EpisodeSummary.js index f6ce4d747..2b51ba7cf 100644 --- a/frontend/src/Episode/Summary/EpisodeSummary.js +++ b/frontend/src/Episode/Summary/EpisodeSummary.js @@ -153,7 +153,7 @@ class EpisodeSummary extends Component { EpisodeSummary.propTypes = { qualityProfileId: PropTypes.number.isRequired, overview: PropTypes.string, - albumLabel: PropTypes.string, + albumLabel: PropTypes.arrayOf(PropTypes.string), releaseDate: PropTypes.string.isRequired, path: PropTypes.string, size: PropTypes.number, diff --git a/src/Lidarr.Api.V3/Albums/AlbumResource.cs b/src/Lidarr.Api.V3/Albums/AlbumResource.cs index 5f1c23d0e..3d13d276a 100644 --- a/src/Lidarr.Api.V3/Albums/AlbumResource.cs +++ b/src/Lidarr.Api.V3/Albums/AlbumResource.cs @@ -13,7 +13,7 @@ namespace Lidarr.Api.V3.Albums { public string Title { get; set; } public int ArtistId { get; set; } - public string AlbumLabel { get; set; } + public List AlbumLabel { get; set; } public bool Monitored { get; set; } public string Path { get; set; } public int ProfileId { get; set; } diff --git a/src/NzbDrone.Api/Albums/AlbumResource.cs b/src/NzbDrone.Api/Albums/AlbumResource.cs index e66d67c64..1f500268d 100644 --- a/src/NzbDrone.Api/Albums/AlbumResource.cs +++ b/src/NzbDrone.Api/Albums/AlbumResource.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Api.Albums public string Title { get; set; } public int ArtistId { get; set; } - public string Label { get; set; } + public List Label { get; set; } public bool Monitored { get; set; } public string Path { get; set; } public int ProfileId { get; set; } diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs index 5e5a1f13d..0c701a546 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,7 +20,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public string Title { get; set; } // In case of a takedown, this may be empty public string Overview { get; set; } public List Genres { get; set; } - public string Label { get; set; } + public List Label { get; set; } public string Type { get; set; } public List Tracks { get; set; } } diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 6d29b221f..24001423a 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -143,6 +143,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook album.CleanTitle = Parser.Parser.CleanArtistTitle(album.Title); album.AlbumType = resource.Type; album.Images = resource.Images.Select(MapImage).ToList(); + album.Label = resource.Label; var tracks = resource.Tracks.Select(MapTrack); album.Tracks = tracks.ToList(); diff --git a/src/NzbDrone.Core/Music/Album.cs b/src/NzbDrone.Core/Music/Album.cs index e46a70ceb..3a35fb015 100644 --- a/src/NzbDrone.Core/Music/Album.cs +++ b/src/NzbDrone.Core/Music/Album.cs @@ -1,4 +1,4 @@ -using NzbDrone.Common.Extensions; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Datastore; using NzbDrone.Core.Tv; using System; @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Music public string Title { get; set; } public string CleanTitle { get; set; } public DateTime? ReleaseDate { get; set; } - public string Label { get; set; } + public List Label { get; set; } //public int TrackCount { get; set; } public string Path { get; set; } public int ProfileId { get; set; } diff --git a/src/NzbDrone.Core/Music/RefreshAlbumService.cs b/src/NzbDrone.Core/Music/RefreshAlbumService.cs index 4fddf1d6b..67925f04e 100644 --- a/src/NzbDrone.Core/Music/RefreshAlbumService.cs +++ b/src/NzbDrone.Core/Music/RefreshAlbumService.cs @@ -1,4 +1,4 @@ -using NLog; +using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Music.Events; @@ -80,6 +80,7 @@ namespace NzbDrone.Core.Music albumToUpdate.ArtistId = artist.Id; albumToUpdate.AlbumType = album.AlbumType; albumToUpdate.Genres = album.Genres; + albumToUpdate.Label = album.Label; albumToUpdate.Images = album.Images; albumToUpdate.ReleaseDate = album.ReleaseDate; albumToUpdate.Duration = album.Tracks.Sum(track => track.Duration);