mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
Add Support for Artist Links from Metadata
This commit is contained in:
parent
06a2f65fd9
commit
d2bafd4605
11 changed files with 169 additions and 74 deletions
|
@ -159,6 +159,7 @@ class ArtistDetails extends Component {
|
||||||
monitored,
|
monitored,
|
||||||
status,
|
status,
|
||||||
overview,
|
overview,
|
||||||
|
links,
|
||||||
images,
|
images,
|
||||||
albums,
|
albums,
|
||||||
alternateTitles,
|
alternateTitles,
|
||||||
|
@ -416,6 +417,7 @@ class ArtistDetails extends Component {
|
||||||
tooltip={
|
tooltip={
|
||||||
<ArtistDetailsLinks
|
<ArtistDetailsLinks
|
||||||
foreignArtistId={foreignArtistId}
|
foreignArtistId={foreignArtistId}
|
||||||
|
links={links}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
kind={kinds.INVERSE}
|
kind={kinds.INVERSE}
|
||||||
|
@ -541,6 +543,7 @@ ArtistDetails.propTypes = {
|
||||||
monitored: PropTypes.bool.isRequired,
|
monitored: PropTypes.bool.isRequired,
|
||||||
status: PropTypes.string.isRequired,
|
status: PropTypes.string.isRequired,
|
||||||
overview: PropTypes.string.isRequired,
|
overview: PropTypes.string.isRequired,
|
||||||
|
links: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
albums: PropTypes.arrayOf(PropTypes.object).isRequired,
|
albums: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
alternateTitles: PropTypes.arrayOf(PropTypes.string).isRequired,
|
alternateTitles: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
|
|
|
@ -7,11 +7,13 @@ import styles from './ArtistDetailsLinks.css';
|
||||||
|
|
||||||
function ArtistDetailsLinks(props) {
|
function ArtistDetailsLinks(props) {
|
||||||
const {
|
const {
|
||||||
foreignArtistId
|
foreignArtistId,
|
||||||
|
links
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.links}>
|
<div className={styles.links}>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
to={`https://musicbrainz.org/artist/${foreignArtistId}`}
|
to={`https://musicbrainz.org/artist/${foreignArtistId}`}
|
||||||
|
@ -25,12 +27,37 @@ function ArtistDetailsLinks(props) {
|
||||||
</Label>
|
</Label>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
{links.map((link, index) => {
|
||||||
|
return (
|
||||||
|
<span key={index}>
|
||||||
|
<Link className={styles.link}
|
||||||
|
to={link.url}
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
<Label
|
||||||
|
className={styles.linkLabel}
|
||||||
|
kind={kinds.INFO}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
>
|
||||||
|
{link.name}
|
||||||
|
</Label>
|
||||||
|
</Link>
|
||||||
|
{(index > 0 && index % 5 === 0) &&
|
||||||
|
<br></br>
|
||||||
|
}
|
||||||
|
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtistDetailsLinks.propTypes = {
|
ArtistDetailsLinks.propTypes = {
|
||||||
foreignArtistId: PropTypes.string.isRequired
|
foreignArtistId: PropTypes.string.isRequired,
|
||||||
|
links: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ArtistDetailsLinks;
|
export default ArtistDetailsLinks;
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace Lidarr.Api.V3.Artist
|
||||||
public int DiscogsId { get; set; }
|
public int DiscogsId { get; set; }
|
||||||
public string AllMusicId { get; set; }
|
public string AllMusicId { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
|
public List<Links> Links { get; set; }
|
||||||
|
|
||||||
public int? AlbumCount { get; set; }
|
public int? AlbumCount { get; set; }
|
||||||
public int? TotalTrackCount { get; set; }
|
public int? TotalTrackCount { get; set; }
|
||||||
|
@ -147,6 +148,7 @@ namespace Lidarr.Api.V3.Artist
|
||||||
Path = model.Path,
|
Path = model.Path,
|
||||||
QualityProfileId = model.ProfileId,
|
QualityProfileId = model.ProfileId,
|
||||||
LanguageProfileId = model.LanguageProfileId,
|
LanguageProfileId = model.LanguageProfileId,
|
||||||
|
Links = model.Links,
|
||||||
|
|
||||||
AlbumFolder = model.AlbumFolder,
|
AlbumFolder = model.AlbumFolder,
|
||||||
Monitored = model.Monitored,
|
Monitored = model.Monitored,
|
||||||
|
@ -192,6 +194,7 @@ namespace Lidarr.Api.V3.Artist
|
||||||
Path = resource.Path,
|
Path = resource.Path,
|
||||||
ProfileId = resource.QualityProfileId,
|
ProfileId = resource.QualityProfileId,
|
||||||
LanguageProfileId = resource.LanguageProfileId,
|
LanguageProfileId = resource.LanguageProfileId,
|
||||||
|
Links = resource.Links,
|
||||||
|
|
||||||
AlbumFolder = resource.AlbumFolder,
|
AlbumFolder = resource.AlbumFolder,
|
||||||
Monitored = resource.Monitored,
|
Monitored = resource.Monitored,
|
||||||
|
|
20
src/NzbDrone.Core/Datastore/Migration/117_artist_links.cs
Normal file
20
src/NzbDrone.Core/Datastore/Migration/117_artist_links.cs
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -16,8 +16,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public List<ImageResource> Images { get; set; }
|
public List<ImageResource> Images { get; set; }
|
||||||
|
public List<LinkResource> Links { get; set; }
|
||||||
public string ArtistName { get; set; }
|
public string ArtistName { get; set; }
|
||||||
public List<AlbumResource> Albums { get; set; }
|
public List<AlbumResource> Albums { get; set; }
|
||||||
|
public string Status { get; set; }
|
||||||
|
public RatingResource Rating { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||||
|
{
|
||||||
|
public class LinkResource
|
||||||
|
{
|
||||||
|
public string Target { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -174,8 +174,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
artist.CleanName = Parser.Parser.CleanArtistTitle(artist.Name);
|
artist.CleanName = Parser.Parser.CleanArtistTitle(artist.Name);
|
||||||
artist.SortName = SeriesTitleNormalizer.Normalize(artist.Name, 0);
|
artist.SortName = SeriesTitleNormalizer.Normalize(artist.Name, 0);
|
||||||
artist.Images = resource.Images.Select(MapImage).ToList();
|
artist.Images = resource.Images.Select(MapImage).ToList();
|
||||||
artist.Status = ArtistStatusType.Continuing; // TODO: Remove HACK when we get from Metadata
|
artist.Status = MapArtistStatus(resource.Status);
|
||||||
artist.Ratings = MapRatings(null); // TODO: Remove HACK when we get from Metadata
|
artist.Ratings = MapRatings(resource.Rating);
|
||||||
|
artist.Links = resource.Links.Select(MapLink).ToList();
|
||||||
|
|
||||||
return artist;
|
return artist;
|
||||||
}
|
}
|
||||||
|
@ -201,6 +202,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
private static ArtistStatusType MapArtistStatus(string status)
|
private static ArtistStatusType MapArtistStatus(string status)
|
||||||
{
|
{
|
||||||
|
if (status == null)
|
||||||
|
{
|
||||||
|
return ArtistStatusType.Continuing;
|
||||||
|
}
|
||||||
|
|
||||||
if (status.Equals("ended", StringComparison.InvariantCultureIgnoreCase))
|
if (status.Equals("ended", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
return ArtistStatusType.Ended;
|
return ArtistStatusType.Ended;
|
||||||
|
@ -209,14 +215,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
return ArtistStatusType.Continuing;
|
return ArtistStatusType.Continuing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Core.Music.Ratings MapRatings(RatingResource rating)
|
private static Music.Ratings MapRatings(RatingResource rating)
|
||||||
{
|
{
|
||||||
if (rating == null)
|
if (rating == null)
|
||||||
{
|
{
|
||||||
return new Core.Music.Ratings();
|
return new Music.Ratings();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Core.Music.Ratings
|
return new Music.Ratings
|
||||||
{
|
{
|
||||||
Votes = rating.Count,
|
Votes = rating.Count,
|
||||||
Value = rating.Value
|
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)
|
private static MediaCoverTypes MapCoverType(string coverType)
|
||||||
{
|
{
|
||||||
switch (coverType.ToLower())
|
switch (coverType.ToLower())
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace NzbDrone.Core.Music
|
||||||
Members = new List<Member>();
|
Members = new List<Member>();
|
||||||
Albums = new List<Album>();
|
Albums = new List<Album>();
|
||||||
Tags = new HashSet<int>();
|
Tags = new HashSet<int>();
|
||||||
|
Links = new List<Links>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ namespace NzbDrone.Core.Music
|
||||||
public ArtistStatusType Status { get; set; }
|
public ArtistStatusType Status { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public List<MediaCover.MediaCover> Images { get; set; }
|
public List<MediaCover.MediaCover> Images { get; set; }
|
||||||
|
public List<Links> Links { get; set; }
|
||||||
public List<string> Genres { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
|
|
10
src/NzbDrone.Core/Music/Links.cs
Normal file
10
src/NzbDrone.Core/Music/Links.cs
Normal file
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
using NzbDrone.Core.Exceptions;
|
using NzbDrone.Core.Exceptions;
|
||||||
|
@ -79,6 +79,7 @@ namespace NzbDrone.Core.Music
|
||||||
artist.LastInfoSync = DateTime.UtcNow;
|
artist.LastInfoSync = DateTime.UtcNow;
|
||||||
artist.Images = artistInfo.Images;
|
artist.Images = artistInfo.Images;
|
||||||
artist.Genres = artistInfo.Genres;
|
artist.Genres = artistInfo.Genres;
|
||||||
|
artist.Links = artistInfo.Links;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -298,6 +298,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Datastore\Migration\105_rename_torrent_downloadstation.cs" />
|
<Compile Include="Datastore\Migration\105_rename_torrent_downloadstation.cs" />
|
||||||
<Compile Include="Datastore\Migration\111_create_language_profiles.cs" />
|
<Compile Include="Datastore\Migration\111_create_language_profiles.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\117_artist_links.cs" />
|
||||||
<Compile Include="Datastore\Migration\116_change_drone_factory_variable_name.cs" />
|
<Compile Include="Datastore\Migration\116_change_drone_factory_variable_name.cs" />
|
||||||
<Compile Include="Datastore\Migration\115_remove_tv_naming.cs" />
|
<Compile Include="Datastore\Migration\115_remove_tv_naming.cs" />
|
||||||
<Compile Include="Datastore\Migration\114_music_blacklist.cs" />
|
<Compile Include="Datastore\Migration\114_music_blacklist.cs" />
|
||||||
|
@ -830,6 +831,7 @@
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\AlbumResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\AlbumResource.cs" />
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\ArtistInfoResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\ArtistInfoResource.cs" />
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\ArtistResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\ArtistResource.cs" />
|
||||||
|
<Compile Include="MetadataSource\SkyHook\Resource\LinkResource.cs" />
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\EpisodeResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\EpisodeResource.cs" />
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\ImageResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\ImageResource.cs" />
|
||||||
<Compile Include="MetadataSource\SkyHook\Resource\RatingResource.cs" />
|
<Compile Include="MetadataSource\SkyHook\Resource\RatingResource.cs" />
|
||||||
|
@ -860,6 +862,7 @@
|
||||||
<Compile Include="Extras\Metadata\MetadataService.cs" />
|
<Compile Include="Extras\Metadata\MetadataService.cs" />
|
||||||
<Compile Include="Extras\Metadata\MetadataType.cs" />
|
<Compile Include="Extras\Metadata\MetadataType.cs" />
|
||||||
<Compile Include="Music\ArtistStatusType.cs" />
|
<Compile Include="Music\ArtistStatusType.cs" />
|
||||||
|
<Compile Include="Music\Links.cs" />
|
||||||
<Compile Include="Music\Commands\MoveArtistCommand.cs" />
|
<Compile Include="Music\Commands\MoveArtistCommand.cs" />
|
||||||
<Compile Include="Music\Events\ArtistMovedEvent.cs" />
|
<Compile Include="Music\Events\ArtistMovedEvent.cs" />
|
||||||
<Compile Include="Music\MonitoringOptions.cs" />
|
<Compile Include="Music\MonitoringOptions.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue