diff --git a/frontend/src/Artist/Details/ArtistDetails.js b/frontend/src/Artist/Details/ArtistDetails.js
index 14a1e6b3e..842c60363 100644
--- a/frontend/src/Artist/Details/ArtistDetails.js
+++ b/frontend/src/Artist/Details/ArtistDetails.js
@@ -159,6 +159,7 @@ class ArtistDetails extends Component {
monitored,
status,
overview,
+ links,
images,
albums,
alternateTitles,
@@ -416,6 +417,7 @@ class ArtistDetails extends Component {
tooltip={
}
kind={kinds.INVERSE}
@@ -541,6 +543,7 @@ ArtistDetails.propTypes = {
monitored: PropTypes.bool.isRequired,
status: PropTypes.string.isRequired,
overview: PropTypes.string.isRequired,
+ links: PropTypes.arrayOf(PropTypes.object).isRequired,
images: PropTypes.arrayOf(PropTypes.object).isRequired,
albums: PropTypes.arrayOf(PropTypes.object).isRequired,
alternateTitles: PropTypes.arrayOf(PropTypes.string).isRequired,
diff --git a/frontend/src/Artist/Details/ArtistDetailsLinks.js b/frontend/src/Artist/Details/ArtistDetailsLinks.js
index f7ec4f4cd..655b6b294 100644
--- a/frontend/src/Artist/Details/ArtistDetailsLinks.js
+++ b/frontend/src/Artist/Details/ArtistDetailsLinks.js
@@ -7,11 +7,13 @@ import styles from './ArtistDetailsLinks.css';
function ArtistDetailsLinks(props) {
const {
- foreignArtistId
+ foreignArtistId,
+ links
} = props;
return (
+
+ {links.map((link, index) => {
+ return (
+
+
+
+
+ {(index > 0 && index % 5 === 0) &&
+
+ }
+
+
+ );
+ })}
+
+
);
}
ArtistDetailsLinks.propTypes = {
- foreignArtistId: PropTypes.string.isRequired
+ foreignArtistId: PropTypes.string.isRequired,
+ links: PropTypes.arrayOf(PropTypes.object).isRequired
};
export default ArtistDetailsLinks;
diff --git a/src/Lidarr.Api.V3/Artist/ArtistResource.cs b/src/Lidarr.Api.V3/Artist/ArtistResource.cs
index ef819e8ad..f0ccb1111 100644
--- a/src/Lidarr.Api.V3/Artist/ArtistResource.cs
+++ b/src/Lidarr.Api.V3/Artist/ArtistResource.cs
@@ -81,6 +81,7 @@ namespace Lidarr.Api.V3.Artist
public int DiscogsId { get; set; }
public string AllMusicId { get; set; }
public string Overview { get; set; }
+ public List Links { get; set; }
public int? AlbumCount { get; set; }
public int? TotalTrackCount { get; set; }
@@ -126,44 +127,45 @@ namespace Lidarr.Api.V3.Artist
if (model == null) return null;
return new ArtistResource
- {
- Id = model.Id,
+ {
+ Id = model.Id,
- ArtistName = model.Name,
- //AlternateTitles
- SortName = model.SortName,
+ ArtistName = model.Name,
+ //AlternateTitles
+ SortName = model.SortName,
- Status = model.Status,
- Overview = model.Overview,
- //NextAiring
- //PreviousAiring
- //Network = model.Network,
- //AirTime = model.AirTime,
- Images = model.Images,
+ Status = model.Status,
+ Overview = model.Overview,
+ //NextAiring
+ //PreviousAiring
+ //Network = model.Network,
+ //AirTime = model.AirTime,
+ Images = model.Images,
- Albums = model.Albums.ToResource(),
- //Year = model.Year,
+ Albums = model.Albums.ToResource(),
+ //Year = model.Year,
- Path = model.Path,
- QualityProfileId = model.ProfileId,
- LanguageProfileId = model.LanguageProfileId,
+ Path = model.Path,
+ QualityProfileId = model.ProfileId,
+ LanguageProfileId = model.LanguageProfileId,
+ Links = model.Links,
- AlbumFolder = model.AlbumFolder,
- Monitored = model.Monitored,
+ AlbumFolder = model.AlbumFolder,
+ Monitored = model.Monitored,
- LastInfoSync = model.LastInfoSync,
- //SeriesType = model.SeriesType,
- CleanName = model.CleanName,
- ForeignArtistId = model.ForeignArtistId,
- NameSlug = model.NameSlug,
- RootFolderPath = model.RootFolderPath,
- //Certification = model.Certification,
- Genres = model.Genres,
- Tags = model.Tags,
- Added = model.Added,
- AddOptions = model.AddOptions,
- Ratings = model.Ratings
- };
+ LastInfoSync = model.LastInfoSync,
+ //SeriesType = model.SeriesType,
+ CleanName = model.CleanName,
+ ForeignArtistId = model.ForeignArtistId,
+ NameSlug = model.NameSlug,
+ RootFolderPath = model.RootFolderPath,
+ //Certification = model.Certification,
+ Genres = model.Genres,
+ Tags = model.Tags,
+ Added = model.Added,
+ AddOptions = model.AddOptions,
+ Ratings = model.Ratings
+ };
}
public static NzbDrone.Core.Music.Artist ToModel(this ArtistResource resource)
@@ -171,44 +173,45 @@ namespace Lidarr.Api.V3.Artist
if (resource == null) return null;
return new NzbDrone.Core.Music.Artist
- {
- Id = resource.Id,
+ {
+ Id = resource.Id,
- Name = resource.ArtistName,
- //AlternateTitles
- SortName = resource.SortName,
+ Name = resource.ArtistName,
+ //AlternateTitles
+ SortName = resource.SortName,
- Status = resource.Status,
- Overview = resource.Overview,
- //NextAiring
- //PreviousAiring
- // Network = resource.Network,
- //AirTime = resource.AirTime,
- Images = resource.Images,
+ Status = resource.Status,
+ Overview = resource.Overview,
+ //NextAiring
+ //PreviousAiring
+ // Network = resource.Network,
+ //AirTime = resource.AirTime,
+ Images = resource.Images,
- //Albums = resource.Albums.ToModel(),
- //Year = resource.Year,
+ //Albums = resource.Albums.ToModel(),
+ //Year = resource.Year,
- Path = resource.Path,
- ProfileId = resource.QualityProfileId,
- LanguageProfileId = resource.LanguageProfileId,
+ Path = resource.Path,
+ ProfileId = resource.QualityProfileId,
+ LanguageProfileId = resource.LanguageProfileId,
+ Links = resource.Links,
- AlbumFolder = resource.AlbumFolder,
- Monitored = resource.Monitored,
+ AlbumFolder = resource.AlbumFolder,
+ Monitored = resource.Monitored,
- LastInfoSync = resource.LastInfoSync,
- //SeriesType = resource.SeriesType,
- CleanName = resource.CleanName,
- ForeignArtistId = resource.ForeignArtistId,
- NameSlug = resource.NameSlug,
- RootFolderPath = resource.RootFolderPath,
- //Certification = resource.Certification,
- Genres = resource.Genres,
- Tags = resource.Tags,
- Added = resource.Added,
- AddOptions = resource.AddOptions,
- Ratings = resource.Ratings
- };
+ LastInfoSync = resource.LastInfoSync,
+ //SeriesType = resource.SeriesType,
+ CleanName = resource.CleanName,
+ ForeignArtistId = resource.ForeignArtistId,
+ NameSlug = resource.NameSlug,
+ RootFolderPath = resource.RootFolderPath,
+ //Certification = resource.Certification,
+ Genres = resource.Genres,
+ Tags = resource.Tags,
+ Added = resource.Added,
+ AddOptions = resource.AddOptions,
+ Ratings = resource.Ratings
+ };
}
public static NzbDrone.Core.Music.Artist ToModel(this ArtistResource resource, NzbDrone.Core.Music.Artist artist)
diff --git a/src/NzbDrone.Core/Datastore/Migration/117_artist_links.cs b/src/NzbDrone.Core/Datastore/Migration/117_artist_links.cs
new file mode 100644
index 000000000..af3eeb65f
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/117_artist_links.cs
@@ -0,0 +1,20 @@
+using FluentMigrator;
+using NzbDrone.Core.Datastore.Migration.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(117)]
+ public class artist_links : NzbDroneMigrationBase
+ {
+ protected override void MainDbUpgrade()
+ {
+ Alter.Table("Artists")
+ .AddColumn("Links").AsString().Nullable();
+ }
+
+ }
+}
diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ArtistResource.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ArtistResource.cs
index f2ab72f94..2dc8f920d 100644
--- a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ArtistResource.cs
+++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/ArtistResource.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -16,8 +16,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
public string Overview { get; set; }
public string Id { get; set; }
public List Images { get; set; }
+ public List Links { get; set; }
public string ArtistName { get; set; }
public List Albums { get; set; }
-
+ public string Status { get; set; }
+ public RatingResource Rating { get; set; }
+
}
}
diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/LinkResource.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/LinkResource.cs
new file mode 100644
index 000000000..3021fbdfe
--- /dev/null
+++ b/src/NzbDrone.Core/MetadataSource/SkyHook/Resource/LinkResource.cs
@@ -0,0 +1,8 @@
+namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
+{
+ public class LinkResource
+ {
+ public string Target { get; set; }
+ public string Type { get; set; }
+ }
+}
diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs
index acdf913c1..835b52b25 100644
--- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs
+++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs
@@ -174,8 +174,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
artist.CleanName = Parser.Parser.CleanArtistTitle(artist.Name);
artist.SortName = SeriesTitleNormalizer.Normalize(artist.Name, 0);
artist.Images = resource.Images.Select(MapImage).ToList();
- artist.Status = ArtistStatusType.Continuing; // TODO: Remove HACK when we get from Metadata
- artist.Ratings = MapRatings(null); // TODO: Remove HACK when we get from Metadata
+ artist.Status = MapArtistStatus(resource.Status);
+ artist.Ratings = MapRatings(resource.Rating);
+ artist.Links = resource.Links.Select(MapLink).ToList();
return artist;
}
@@ -201,6 +202,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private static ArtistStatusType MapArtistStatus(string status)
{
+ if (status == null)
+ {
+ return ArtistStatusType.Continuing;
+ }
+
if (status.Equals("ended", StringComparison.InvariantCultureIgnoreCase))
{
return ArtistStatusType.Ended;
@@ -209,14 +215,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
return ArtistStatusType.Continuing;
}
- private static Core.Music.Ratings MapRatings(RatingResource rating)
+ private static Music.Ratings MapRatings(RatingResource rating)
{
if (rating == null)
{
- return new Core.Music.Ratings();
+ return new Music.Ratings();
}
- return new Core.Music.Ratings
+ return new Music.Ratings
{
Votes = rating.Count,
Value = rating.Value
@@ -232,6 +238,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
};
}
+ private static Music.Links MapLink(LinkResource arg)
+ {
+ return new Music.Links
+ {
+ Url = arg.Target,
+ Name = arg.Type
+ };
+ }
+
private static MediaCoverTypes MapCoverType(string coverType)
{
switch (coverType.ToLower())
diff --git a/src/NzbDrone.Core/Music/Artist.cs b/src/NzbDrone.Core/Music/Artist.cs
index c33bbc489..c9184e42a 100644
--- a/src/NzbDrone.Core/Music/Artist.cs
+++ b/src/NzbDrone.Core/Music/Artist.cs
@@ -20,6 +20,7 @@ namespace NzbDrone.Core.Music
Members = new List();
Albums = new List();
Tags = new HashSet();
+ Links = new List();
}
@@ -40,6 +41,7 @@ namespace NzbDrone.Core.Music
public ArtistStatusType Status { get; set; }
public string Path { get; set; }
public List Images { get; set; }
+ public List Links { get; set; }
public List Genres { get; set; }
public string RootFolderPath { get; set; }
public DateTime Added { get; set; }
diff --git a/src/NzbDrone.Core/Music/Links.cs b/src/NzbDrone.Core/Music/Links.cs
new file mode 100644
index 000000000..abf47eafc
--- /dev/null
+++ b/src/NzbDrone.Core/Music/Links.cs
@@ -0,0 +1,10 @@
+using NzbDrone.Core.Datastore;
+
+namespace NzbDrone.Core.Music
+{
+ public class Links : IEmbeddedDocument
+ {
+ public string Url { get; set; }
+ public string Name { get; set; }
+ }
+}
diff --git a/src/NzbDrone.Core/Music/RefreshArtistService.cs b/src/NzbDrone.Core/Music/RefreshArtistService.cs
index 83a6856b3..503c1fd06 100644
--- a/src/NzbDrone.Core/Music/RefreshArtistService.cs
+++ b/src/NzbDrone.Core/Music/RefreshArtistService.cs
@@ -1,4 +1,4 @@
-using NLog;
+using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Exceptions;
@@ -79,6 +79,7 @@ namespace NzbDrone.Core.Music
artist.LastInfoSync = DateTime.UtcNow;
artist.Images = artistInfo.Images;
artist.Genres = artistInfo.Genres;
+ artist.Links = artistInfo.Links;
try
{
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index 6141243e7..7b848fd9c 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -298,6 +298,7 @@
+
@@ -830,6 +831,7 @@
+
@@ -860,6 +862,7 @@
+