From c833a6dc844d2e44fa167c5d603d5360a6a49f9b Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 8 Apr 2018 02:48:34 -0400 Subject: [PATCH] New: Enable Ratings for Albums --- frontend/src/Album/Details/AlbumDetails.js | 6 ++++-- .../MetadataSource/SkyHook/Resource/AlbumResource.cs | 1 + src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs | 1 + src/NzbDrone.Core/Music/Album.cs | 1 + src/NzbDrone.Core/Music/RefreshAlbumService.cs | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/Album/Details/AlbumDetails.js b/frontend/src/Album/Details/AlbumDetails.js index d4e76e3f0..25b196dba 100644 --- a/frontend/src/Album/Details/AlbumDetails.js +++ b/frontend/src/Album/Details/AlbumDetails.js @@ -140,6 +140,7 @@ class AlbumDetails extends Component { statistics, monitored, releaseDate, + ratings, images, media, isFetching, @@ -280,14 +281,14 @@ class AlbumDetails extends Component { - {/*
+
-
*/} +
@@ -446,6 +447,7 @@ AlbumDetails.propTypes = { albumType: PropTypes.string.isRequired, statistics: PropTypes.object.isRequired, releaseDate: PropTypes.string.isRequired, + ratings: PropTypes.object.isRequired, images: PropTypes.arrayOf(PropTypes.object).isRequired, media: PropTypes.arrayOf(PropTypes.object).isRequired, monitored: PropTypes.bool.isRequired, diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs index a54cdd8d1..3ef2e5670 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/AlbumResource.cs @@ -27,6 +27,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource public List Media { get; set; } public List Tracks { get; set; } public List Releases { get; set; } + public RatingResource Rating { get; set; } public string SelectedRelease { get; set; } public AlbumArtistResource Artist { get; set; } } diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index f8a15715e..449009cfb 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -265,6 +265,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook album.ForeignAlbumId = resource.Id; album.ReleaseDate = resource.ReleaseDate; album.CleanTitle = Parser.Parser.CleanArtistName(album.Title); + album.Ratings = MapRatings(resource.Rating); album.AlbumType = resource.Type; if (resource.Images != null) diff --git a/src/NzbDrone.Core/Music/Album.cs b/src/NzbDrone.Core/Music/Album.cs index c29daf2b8..c01a452b1 100644 --- a/src/NzbDrone.Core/Music/Album.cs +++ b/src/NzbDrone.Core/Music/Album.cs @@ -14,6 +14,7 @@ namespace NzbDrone.Core.Music Media = new List(); Releases = new List(); CurrentRelease = new AlbumRelease(); + Ratings = new Ratings(); } public const string RELEASE_DATE_FORMAT = "yyyy-MM-dd"; diff --git a/src/NzbDrone.Core/Music/RefreshAlbumService.cs b/src/NzbDrone.Core/Music/RefreshAlbumService.cs index 1bc805891..b557605f8 100644 --- a/src/NzbDrone.Core/Music/RefreshAlbumService.cs +++ b/src/NzbDrone.Core/Music/RefreshAlbumService.cs @@ -101,6 +101,7 @@ namespace NzbDrone.Core.Music album.ReleaseDate = albumInfo.ReleaseDate; album.Duration = tuple.Item2.Sum(track => track.Duration); album.Releases = albumInfo.Releases; + album.Ratings = albumInfo.Ratings; album.CurrentRelease = albumInfo.CurrentRelease; _refreshTrackService.RefreshTrackInfo(album, tuple.Item2);