diff --git a/src/Ombi.Api.MusicBrainz/MusicBrainzApi.cs b/src/Ombi.Api.MusicBrainz/MusicBrainzApi.cs index 5a3cefa9a..f096b0073 100644 --- a/src/Ombi.Api.MusicBrainz/MusicBrainzApi.cs +++ b/src/Ombi.Api.MusicBrainz/MusicBrainzApi.cs @@ -12,8 +12,8 @@ namespace Ombi.Api.MusicBrainz { public async Task> SearchArtist(string artistQuery) { - var artist = await Hqub.MusicBrainz.API.Entities.Artist.SearchAsync(artistQuery, 10); - return artist.Items.Where(x => !x.Type.Equals("Person", StringComparison.CurrentCultureIgnoreCase)); + var artist = await Artist.SearchAsync(artistQuery, 10); + return artist.Items.Where(x => x.Type != null); } public async Task GetArtistInformation(string artistId) diff --git a/src/Ombi.Api.MusicBrainz/RelationLinks.cs b/src/Ombi.Api.MusicBrainz/RelationLinks.cs new file mode 100644 index 000000000..8bc031d87 --- /dev/null +++ b/src/Ombi.Api.MusicBrainz/RelationLinks.cs @@ -0,0 +1,19 @@ +namespace Ombi.Api.MusicBrainz +{ + public static class RelationLinks + { + public const string BbcMusic = "d028a975-000c-4525-9333-d3c8425e4b54"; + public const string Imdb = "94c8b0cc-4477-4106-932c-da60e63de61c"; + public const string AllMusic = "6b3e3c85-0002-4f34-aca6-80ace0d7e846"; + public const string Discogs = "04a5b104-a4c2-4bac-99a1-7b837c37d9e4"; + public const string LastFm = "08db8098-c0df-4b78-82c3-c8697b4bba7f"; + public const string MySpace = "bac47923-ecde-4b59-822e-d08f0cd10156"; + public const string Homepage = "fe33d22f-c3b0-4d68-bd53-a856badf2b15"; + public const string OnlineCommunity = "35b3a50f-bf0e-4309-a3b4-58eeed8cee6a"; + public const string SocialNetwork = "99429741-f3f6-484b-84f8-23af51991770"; + public const string Streams = "769085a1-c2f7-4c24-a532-2375a77693bd"; + public const string YouTube = "6a540e5b-58c6-4192-b6ba-dbc71ec8fcf0"; + public const string Download = "f8319a2f-f824-4617-81c8-be6560b3b203"; + + } +} \ No newline at end of file diff --git a/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs index dc490fc70..c1bba8836 100644 --- a/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; +using System.Globalization; +using System.Linq; using System.Security.Principal; using System.Threading.Tasks; +using Hqub.MusicBrainz.API.Entities; using Ombi.Api.MusicBrainz; using Ombi.Core.Authentication; using Ombi.Core.Engine.Interfaces; @@ -12,6 +15,7 @@ using Ombi.Helpers; using Ombi.Settings.Settings.Models; using Ombi.Store.Entities; using Ombi.Store.Repository; +using ReleaseGroup = Ombi.Core.Models.Search.V2.Music.ReleaseGroup; namespace Ombi.Core.Engine.V2 { @@ -20,8 +24,8 @@ namespace Ombi.Core.Engine.V2 private readonly IMusicBrainzApi _musicBrainzApi; public MusicSearchEngineV2(IPrincipal identity, IRequestServiceMain requestService, IRuleEvaluator rules, - OmbiUserManager um, ICacheService cache, ISettingsService ombiSettings, - IRepository sub, IMusicBrainzApi musicBrainzApi) + OmbiUserManager um, ICacheService cache, ISettingsService ombiSettings, + IRepository sub, IMusicBrainzApi musicBrainzApi) : base(identity, requestService, rules, um, cache, ombiSettings, sub) { _musicBrainzApi = musicBrainzApi; @@ -30,7 +34,7 @@ namespace Ombi.Core.Engine.V2 public async Task GetArtistInformation(string artistId) { var artist = await _musicBrainzApi.GetArtistInformation(artistId); - + var info = new ArtistInformation { Id = artistId, @@ -39,9 +43,10 @@ namespace Ombi.Core.Engine.V2 Region = artist.Area?.Name, Type = artist.Type, StartYear = artist.LifeSpan?.Begin ?? "", - EndYear = artist.LifeSpan?.End?? "", + EndYear = artist.LifeSpan?.End ?? "", Disambiguation = artist.Disambiguation, - ReleaseGroups = new List() + ReleaseGroups = new List(), + Members = new List() }; // TODO FINISH MAPPING foreach (var g in artist.ReleaseGroups) @@ -51,11 +56,112 @@ namespace Ombi.Core.Engine.V2 Type = g.PrimaryType, Id = g.Id, Title = g.Title, - ReleaseDate = g.FirstReleaseDate + ReleaseDate = g.FirstReleaseDate, }); } + info.Links = GetLinksForArtist(artist); + info.Members = GetBandMembers(artist); return info; - } + } + + private List GetBandMembers(Artist artist) + { + var members = new List(); + var membersOfBand = artist.Relations.Where(x => x.TypeId == "5be4c609-9afa-4ea0-910b-12ffb71e3821"); + foreach (var member in membersOfBand) + { + members.Add(new BandMember + { + Name = member.Artist?.Name, + Attributes = member.Attributes, + IsCurrentMember = member.Ended == null, + End = member.End, + Start = member.Begin + }); + } + + return members; + } + + private ArtistLinks GetLinksForArtist(Artist artist) + { + var links = new ArtistLinks(); + foreach (var relation in artist.Relations) + { + switch (relation.TypeId) + { + case RelationLinks.AllMusic: + links.AllMusic = relation.Url?.Resource; + break; + case RelationLinks.BbcMusic: + links.BbcMusic = relation.Url?.Resource; + break; + case RelationLinks.Discogs: + links.Discogs = relation.Url?.Resource; + break; + case RelationLinks.Homepage: + links.HomePage = relation.Url?.Resource; + break; + case RelationLinks.Imdb: + links.Imdb = relation.Url?.Resource; + break; + case RelationLinks.LastFm: + links.LastFm = relation.Url?.Resource; + break; + case RelationLinks.MySpace: + links.MySpace = relation.Url?.Resource; + break; + case RelationLinks.OnlineCommunity: + links.OnlineCommunity = relation.Url?.Resource; + break; + case RelationLinks.SocialNetwork: + if ((relation.Url?.Resource ?? string.Empty).Contains("twitter", CompareOptions.IgnoreCase)) + { + links.Twitter = relation.Url?.Resource; + } + if ((relation.Url?.Resource ?? string.Empty).Contains("facebook", CompareOptions.IgnoreCase)) + { + links.Facebook = relation.Url?.Resource; + } + if ((relation.Url?.Resource ?? string.Empty).Contains("instagram", CompareOptions.IgnoreCase)) + { + links.Instagram = relation.Url?.Resource; + } + if ((relation.Url?.Resource ?? string.Empty).Contains("vk", CompareOptions.IgnoreCase)) + { + links.Vk = relation.Url?.Resource; + } + break; + case RelationLinks.Streams: + if ((relation.Url?.Resource ?? string.Empty).Contains("spotify", CompareOptions.IgnoreCase)) + { + links.Spotify = relation.Url?.Resource; + } + if ((relation.Url?.Resource ?? string.Empty).Contains("deezer", CompareOptions.IgnoreCase)) + { + links.Deezer = relation.Url?.Resource; + } + + break; + case RelationLinks.YouTube: + links.YouTube = relation.Url?.Resource; + break; + case RelationLinks.Download: + if ((relation.Url?.Resource ?? string.Empty).Contains("google", CompareOptions.IgnoreCase)) + { + links.Google = relation.Url?.Resource; + } + if ((relation.Url?.Resource ?? string.Empty).Contains("apple", CompareOptions.IgnoreCase)) + { + links.Apple = relation.Url?.Resource; + } + + break; + } + } + + return links; + } } } \ No newline at end of file diff --git a/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs b/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs index e6f32990b..b73e7dbc1 100644 --- a/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs +++ b/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs @@ -8,12 +8,23 @@ namespace Ombi.Core.Models.Search.V2.Music public string Id { get; set; } public string StartYear { get; set; } public string EndYear { get; set; } + public bool IsEnded => EndYear != null; public string Type { get; set; } public string Country { get; set; } public string Region { get; set; } public string Disambiguation { get; set; } public List ReleaseGroups { get; set; } - public List Links { get; set; } + public ArtistLinks Links { get; set; } + public List Members { get; set; } + } + + public class BandMember + { + public string Name { get; set; } + public string[] Attributes { get; set; } + public bool IsCurrentMember { get; set; } + public string Start { get; set; } + public string End { get; set; } } public class ArtistLinks @@ -22,11 +33,20 @@ namespace Ombi.Core.Models.Search.V2.Music public string Imdb { get; set; } public string LastFm { get; set; } public string Discogs { get; set; } - public string BandsInTown { get; set; } - public string Website { get; set; } + public string AllMusic { get; set; } + public string HomePage { get; set; } public string YouTube { get; set; } public string Facebook { get; set; } public string Twitter { get; set; } + public string BbcMusic { get; set; } + public string MySpace { get; set; } + public string OnlineCommunity { get; set; } + public string Spotify { get; set; } + public string Instagram { get; set; } + public string Vk { get; set; } + public string Deezer { get; set; } + public string Google { get; set; } + public string Apple { get; set; } } public class ReleaseGroup diff --git a/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts b/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts index de4fc3898..9827aef29 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts @@ -6,4 +6,44 @@ export interface IArtistSearchResult { type: string; country: string; region: string; + disambiguation: string; + releaseGroups: IReleaseGroups[]; + links: IArtistLinks; + members: IBandMembers[]; +} + +export interface IReleaseGroups { + id: string; + title: string; + releaseDate: string; + type: string; +} + +export interface IArtistLinks { + image: string; + imdb: string; + lastFm: string; + discogs: string; + allMusic: string; + homePage: string; + youTube: string; + facebook: string; + twitter: string; + bbcMusic: string; + mySpace: string; + onlineCommunity: string; + spotify: string; + instagram: string; + vk: string; + deezer: string; + google: string; + apple: string; +} + +export interface IBandMembers { + name: string; + attributes: string[]; + isCurrentMember: boolean; + start: string; + end: string; } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/settings/lidarr/lidarr.component.html b/src/Ombi/ClientApp/src/app/settings/lidarr/lidarr.component.html index 88aac08b9..6824214d7 100644 --- a/src/Ombi/ClientApp/src/app/settings/lidarr/lidarr.component.html +++ b/src/Ombi/ClientApp/src/app/settings/lidarr/lidarr.component.html @@ -94,6 +94,8 @@ +
diff --git a/src/Ombi/ClientApp/yarn.lock b/src/Ombi/ClientApp/yarn.lock index d71e95589..c4dc3f0ec 100644 --- a/src/Ombi/ClientApp/yarn.lock +++ b/src/Ombi/ClientApp/yarn.lock @@ -255,6 +255,16 @@ dependencies: url "^0.11.0" +"@fullcalendar/core@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@fullcalendar/core/-/core-4.2.0.tgz#16716d6617137e54fceeb03c72f5124c92b86e58" + integrity sha512-4kd5OGHxjMtwI0gUHKwAYzmR0Z79Qf8y0ARx2Ruh20JdVy3Tznn6oKwdpkUbaXWrLXNDoXYRkBiFCIgC27VNCw== + +"@fullcalendar/interaction@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@fullcalendar/interaction/-/interaction-4.2.0.tgz#312e83f575aed67c33aec69884664d436aaedef2" + integrity sha512-wwAyocUp1HEY7c7xCymR9EGdh7AWZrwNiBQlIpP3ne0eJT0U4ZjlnoOoels3VPsTJ9a6pdO1/XoGjEvL1T5y4g== + "@ng-bootstrap/ng-bootstrap@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-4.0.1.tgz#75a6b881b24d869624caa5b5f8a4070650ad5bc4" @@ -2498,15 +2508,15 @@ fstream@^1.0.0, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" -fullcalendar@4.0.0-alpha.2: - version "4.0.0-alpha.2" - resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-4.0.0-alpha.2.tgz#af5219bd955ee3c3549a39777808dd1dda645111" - integrity sha512-2trFzbvQWHijyt+u8Zv98PPfDkFH5bU5Yoqvn2ot5PTwIkLK95xrNat5jTHfpBMwh+KqHQSnux/BcGXARYgwcw== +fullcalendar@^4.0.0-alpha.4: + version "4.0.0-alpha.4" + resolved "https://registry.yarnpkg.com/fullcalendar/-/fullcalendar-4.0.0-alpha.4.tgz#c33035af6cf13559b628525a8fb8169cc15f13ca" + integrity sha512-6uup/KTSSlybpj3ntiYvDlpbU82Z9deeW9D8zO/MJLcsKD/i+I4kWEnoJLp1egZdAHq9xGsJ9PLTBU/xz6QqGw== dependencies: - luxon "^1.4.2" - moment "^2.22.2" - moment-timezone "^0.5.21" - rrule "^2.5.6" + luxon "^1.10.0" + moment "^2.23.0" + moment-timezone "^0.5.23" + rrule "^2.6.0" superagent "^3.8.3" function-bind@^1.1.1: @@ -3536,7 +3546,12 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -luxon@^1.3.3, luxon@^1.4.2: +luxon@^1.10.0: + version "1.17.2" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.17.2.tgz#95189c450341cfddf5f826ef8c32b5b022943fd5" + integrity sha512-qELKtIj3HD41N+MvgoxArk8DZGUb4Gpiijs91oi+ZmKJzRlxY6CoyTwNoUwnogCVs4p8HuxVJDik9JbnYgrCng== + +luxon@^1.3.3: version "1.12.0" resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.12.0.tgz#d02d53c8d8aaebe6b4c00ba1ce1be3913546b2e7" integrity sha512-enPnPIHd5ZnZT0vpj9Xv8aq4j0yueAkhnh4xUKUHpqlgSm1r/8s6xTMjfyp2ugOWP7zivqJqgVTkW+rpHed61w== @@ -3803,14 +3818,14 @@ mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: dependencies: minimist "0.0.8" -moment-timezone@^0.5.21: - version "0.5.23" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.23.tgz#7cbb00db2c14c71b19303cb47b0fb0a6d8651463" - integrity sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w== +moment-timezone@^0.5.23: + version "0.5.26" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.26.tgz#c0267ca09ae84631aa3dc33f65bedbe6e8e0d772" + integrity sha512-sFP4cgEKTCymBBKgoxZjYzlSovC20Y6J7y3nanDc5RoBIXKlZhoYwBoZGe3flwU6A372AcRwScH8KiwV6zjy1g== dependencies: moment ">= 2.9.0" -"moment@>= 2.9.0", moment@^2.10.6, moment@^2.22.2, moment@^2.23.0: +"moment@>= 2.9.0", moment@^2.10.6, moment@^2.23.0: version "2.24.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" @@ -5123,10 +5138,12 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rrule@^2.5.6: - version "2.6.0" - resolved "https://registry.yarnpkg.com/rrule/-/rrule-2.6.0.tgz#7aeefe89273e4796d1fabf03051d5e1d68169502" - integrity sha512-TRigkTJtG7Y1yOjNSKvFvVmvj/PzRZLR8lLcPW9GASOlaoqoL1J0kNuUV9I3LuZc7qFT+QB2NbxSLL9d33/ylg== +rrule@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rrule/-/rrule-2.6.2.tgz#f175c6c0b20d6f798739e4e1d979ffb3d79589e8" + integrity sha512-xL38CM1zOYOIp4OO8hdD6zHH5UdR9siHMvPiv+CCSh7o0LYJ0owg87QcFW7GXJ0PfpLBHjanEMvvBjJxbRhAcQ== + dependencies: + tslib "^1.9.0" optionalDependencies: luxon "^1.3.3" diff --git a/src/Ombi/Properties/launchSettings.json b/src/Ombi/Properties/launchSettings.json index 19e5d23af..e979c0ea0 100644 --- a/src/Ombi/Properties/launchSettings.json +++ b/src/Ombi/Properties/launchSettings.json @@ -2,6 +2,10 @@ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, + "iis": { + "applicationUrl": "http://localhost/Ombi", + "sslPort": 0 + }, "iisExpress": { "applicationUrl": "http://localhost:3577/", "sslPort": 0 @@ -17,7 +21,9 @@ } }, "Ombi": { - "commandName": "Project" + "commandName": "IISExpress", + "commandLineArgs": "--host http://*:3577", + "applicationUrl": "http://localhost:3577/" } } } \ No newline at end of file