mirror of https://github.com/lidarr/Lidarr
Add Support for Artist Links from Metadata
This commit is contained in:
parent
06a2f65fd9
commit
d2bafd4605
|
@ -159,6 +159,7 @@ class ArtistDetails extends Component {
|
|||
monitored,
|
||||
status,
|
||||
overview,
|
||||
links,
|
||||
images,
|
||||
albums,
|
||||
alternateTitles,
|
||||
|
@ -416,6 +417,7 @@ class ArtistDetails extends Component {
|
|||
tooltip={
|
||||
<ArtistDetailsLinks
|
||||
foreignArtistId={foreignArtistId}
|
||||
links={links}
|
||||
/>
|
||||
}
|
||||
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,
|
||||
|
|
|
@ -7,11 +7,13 @@ import styles from './ArtistDetailsLinks.css';
|
|||
|
||||
function ArtistDetailsLinks(props) {
|
||||
const {
|
||||
foreignArtistId
|
||||
foreignArtistId,
|
||||
links
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div className={styles.links}>
|
||||
|
||||
<Link
|
||||
className={styles.link}
|
||||
to={`https://musicbrainz.org/artist/${foreignArtistId}`}
|
||||
|
@ -25,12 +27,37 @@ function ArtistDetailsLinks(props) {
|
|||
</Label>
|
||||
</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>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
ArtistDetailsLinks.propTypes = {
|
||||
foreignArtistId: PropTypes.string.isRequired
|
||||
foreignArtistId: PropTypes.string.isRequired,
|
||||
links: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||
};
|
||||
|
||||
export default ArtistDetailsLinks;
|
||||
|
|
|
@ -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> 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)
|
||||
|
|
|
@ -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.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<ImageResource> Images { get; set; }
|
||||
public List<LinkResource> Links { get; set; }
|
||||
public string ArtistName { 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.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())
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace NzbDrone.Core.Music
|
|||
Members = new List<Member>();
|
||||
Albums = new List<Album>();
|
||||
Tags = new HashSet<int>();
|
||||
Links = new List<Links>();
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,6 +41,7 @@ namespace NzbDrone.Core.Music
|
|||
public ArtistStatusType Status { get; set; }
|
||||
public string Path { get; set; }
|
||||
public List<MediaCover.MediaCover> Images { get; set; }
|
||||
public List<Links> Links { get; set; }
|
||||
public List<string> Genres { get; set; }
|
||||
public string RootFolderPath { get; set; }
|
||||
public DateTime Added { get; set; }
|
||||
|
|
|
@ -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.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
|
||||
{
|
||||
|
|
|
@ -298,6 +298,7 @@
|
|||
</Compile>
|
||||
<Compile Include="Datastore\Migration\105_rename_torrent_downloadstation.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\115_remove_tv_naming.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\ArtistInfoResource.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\ImageResource.cs" />
|
||||
<Compile Include="MetadataSource\SkyHook\Resource\RatingResource.cs" />
|
||||
|
@ -860,6 +862,7 @@
|
|||
<Compile Include="Extras\Metadata\MetadataService.cs" />
|
||||
<Compile Include="Extras\Metadata\MetadataType.cs" />
|
||||
<Compile Include="Music\ArtistStatusType.cs" />
|
||||
<Compile Include="Music\Links.cs" />
|
||||
<Compile Include="Music\Commands\MoveArtistCommand.cs" />
|
||||
<Compile Include="Music\Events\ArtistMovedEvent.cs" />
|
||||
<Compile Include="Music\MonitoringOptions.cs" />
|
||||
|
|
Loading…
Reference in New Issue