From ad6e651090ee831288c14f9c735d092295b5aecc Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 4 May 2018 18:34:03 -0400 Subject: [PATCH] New: Show Release Title on Release Selection (#343) Fixes #329 --- .../Components/Form/AlbumReleaseSelectInputConnector.js | 9 ++++++--- src/Lidarr.Api.V1/Albums/AlbumReleaseResource.cs | 3 +++ .../MetadataSource/SkyHook/Resource/ReleaseResource.cs | 1 + src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs | 1 + src/NzbDrone.Core/Music/AlbumRelease.cs | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js b/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js index 48f504dd9..e07b4ec7e 100644 --- a/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js +++ b/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js @@ -15,17 +15,20 @@ function createMapStateToProps() { return { key: albumRelease.id, - value: `${albumRelease.mediaCount} med, ${albumRelease.trackCount} tracks` + + value: `${albumRelease.title}` + + `${albumRelease.disambiguation ? ' (' : ''}${titleCase(albumRelease.disambiguation)}${albumRelease.disambiguation ? ')' : ''}` + + `, ${albumRelease.mediaCount} med, ${albumRelease.trackCount} tracks` + `${albumRelease.country.length > 0 ? ', ' : ''}${albumRelease.country}` + - `${albumRelease.disambiguation ? ', ' : ''}${titleCase(albumRelease.disambiguation)}` + `${albumRelease.format ? ', [' : ''}${albumRelease.format}${albumRelease.format ? ']' : ''}` }; }); + const sortedValues = _.orderBy(values, ['value']); + const value = selectedRelease.value.id; return { - values, + values: sortedValues, value }; } diff --git a/src/Lidarr.Api.V1/Albums/AlbumReleaseResource.cs b/src/Lidarr.Api.V1/Albums/AlbumReleaseResource.cs index a4f3db485..6667cc30d 100644 --- a/src/Lidarr.Api.V1/Albums/AlbumReleaseResource.cs +++ b/src/Lidarr.Api.V1/Albums/AlbumReleaseResource.cs @@ -8,6 +8,7 @@ namespace Lidarr.Api.V1.Albums public class AlbumReleaseResource { public string Id { get; set; } + public string Title { get; set; } public DateTime? ReleaseDate { get; set; } public int TrackCount { get; set; } public int MediaCount { get; set; } @@ -29,6 +30,7 @@ namespace Lidarr.Api.V1.Albums return new AlbumReleaseResource { Id = model.Id, + Title = model.Title, ReleaseDate = model.ReleaseDate, TrackCount = model.TrackCount, MediaCount = model.MediaCount, @@ -49,6 +51,7 @@ namespace Lidarr.Api.V1.Albums return new AlbumRelease { Id = resource.Id, + Title = resource.Title, ReleaseDate = resource.ReleaseDate, TrackCount = resource.TrackCount, MediaCount = resource.MediaCount, diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ReleaseResource.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ReleaseResource.cs index 815aec43f..bc9de7839 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ReleaseResource.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ReleaseResource.cs @@ -12,6 +12,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public string Disambiguation { get; set; } public List Label {get; set;} public List Country { get; set; } + public string Title { get; set; } public string Format { get; set; } } } diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 449009cfb..bbfdc0879 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -313,6 +313,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook AlbumRelease albumRelease = new AlbumRelease { Id = resource.Id, + Title = resource.Title, ReleaseDate = resource.ReleaseDate, TrackCount = resource.TrackCount, Format = resource.Format, diff --git a/src/NzbDrone.Core/Music/AlbumRelease.cs b/src/NzbDrone.Core/Music/AlbumRelease.cs index 361ca4796..93545c857 100644 --- a/src/NzbDrone.Core/Music/AlbumRelease.cs +++ b/src/NzbDrone.Core/Music/AlbumRelease.cs @@ -7,6 +7,7 @@ namespace NzbDrone.Core.Music public class AlbumRelease : IEmbeddedDocument { public string Id { get; set; } + public string Title { get; set; } public DateTime? ReleaseDate { get; set; } public int TrackCount { get; set; } public int MediaCount { get; set; }