mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-11 15:47:09 -07:00
More Work on Album Filtering per Artist
This commit is contained in:
parent
6a4fb9adf3
commit
f812302aa5
13 changed files with 43 additions and 54 deletions
|
@ -167,28 +167,6 @@ class AddNewArtistModalContent extends Component {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>Primary Album Types</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TEXT}
|
|
||||||
name="primaryAlbumTypes"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...primaryAlbumTypes}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>Secondary Album Types</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TEXT}
|
|
||||||
name="secondaryAlbumTypes"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...secondaryAlbumTypes}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Tags</FormLabel>
|
<FormLabel>Tags</FormLabel>
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ export const defaultState = {
|
||||||
qualityProfileId: 0,
|
qualityProfileId: 0,
|
||||||
languageProfileId: 0,
|
languageProfileId: 0,
|
||||||
seriesType: 'standard',
|
seriesType: 'standard',
|
||||||
primaryAlbumTypes: 'Studio, Single',
|
primaryAlbumTypes: ['Album'],
|
||||||
secondaryAlbumTypes: '',
|
secondaryAlbumTypes: ['Studio'],
|
||||||
albumFolder: true,
|
albumFolder: true,
|
||||||
tags: []
|
tags: []
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace Lidarr.Api.V3.Artist
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public string ArtistType { get; set; }
|
public string ArtistType { get; set; }
|
||||||
public string Disambiguation { get; set; }
|
public string Disambiguation { get; set; }
|
||||||
public string PrimaryAlbumTypes { get; set; }
|
public List<string> PrimaryAlbumTypes { get; set; }
|
||||||
public string SecondaryAlbumTypes { get; set; }
|
public List<string> SecondaryAlbumTypes { get; set; }
|
||||||
public List<Links> Links { get; set; }
|
public List<Links> Links { get; set; }
|
||||||
|
|
||||||
public int? AlbumCount { get; set; }
|
public int? AlbumCount { get; set; }
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.MetadataSource.SkyHook
|
||||||
[TestCase("66c662b6-6e2f-4930-8610-912e24c63ed1", "AC/DC")]
|
[TestCase("66c662b6-6e2f-4930-8610-912e24c63ed1", "AC/DC")]
|
||||||
public void should_be_able_to_get_artist_detail(string mbId, string name)
|
public void should_be_able_to_get_artist_detail(string mbId, string name)
|
||||||
{
|
{
|
||||||
var details = Subject.GetArtistInfo(mbId);
|
var details = Subject.GetArtistInfo(mbId, new List<string> { "Album" }, new List<string> { "Studio" });
|
||||||
|
|
||||||
ValidateArtist(details.Item1);
|
ValidateArtist(details.Item1);
|
||||||
ValidateAlbums(details.Item2);
|
ValidateAlbums(details.Item2);
|
||||||
|
@ -37,13 +37,13 @@ namespace NzbDrone.Core.Test.MetadataSource.SkyHook
|
||||||
[Test]
|
[Test]
|
||||||
public void getting_details_of_invalid_artist()
|
public void getting_details_of_invalid_artist()
|
||||||
{
|
{
|
||||||
Assert.Throws<ArtistNotFoundException>(() => Subject.GetArtistInfo("aaaaaa-aaa-aaaa-aaaa"));
|
Assert.Throws<ArtistNotFoundException>(() => Subject.GetArtistInfo("aaaaaa-aaa-aaaa-aaaa", new List<string> { "Album" }, new List<string> { "Studio" }));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_have_period_at_start_of_name_slug()
|
public void should_not_have_period_at_start_of_name_slug()
|
||||||
{
|
{
|
||||||
var details = Subject.GetArtistInfo("f59c5520-5f46-4d2c-b2c4-822eabf53419");
|
var details = Subject.GetArtistInfo("b6db95cd-88d9-492f-bbf6-a34e0e89b2e5", new List<string> { "Album" }, new List<string> { "Studio" });
|
||||||
|
|
||||||
details.Item1.NameSlug.Should().Be("dothack");
|
details.Item1.NameSlug.Should().Be("dothack");
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,6 @@ namespace NzbDrone.Core.Test.MetadataSource.SkyHook
|
||||||
{
|
{
|
||||||
albums.Should().NotBeEmpty();
|
albums.Should().NotBeEmpty();
|
||||||
|
|
||||||
var episodeGroup = albums.GroupBy(e => e.AlbumType + e.Title);
|
|
||||||
episodeGroup.Should().OnlyContain(c => c.Count() == 1);
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var episode in albums)
|
foreach (var episode in albums)
|
||||||
{
|
{
|
||||||
ValidateAlbum(episode);
|
ValidateAlbum(episode);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
private void GivenValidArtist(string lidarrId)
|
private void GivenValidArtist(string lidarrId)
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IProvideArtistInfo>()
|
Mocker.GetMock<IProvideArtistInfo>()
|
||||||
.Setup(s => s.GetArtistInfo(lidarrId))
|
.Setup(s => s.GetArtistInfo(lidarrId, It.IsAny<List<string>>(), It.IsAny<List<string>>()))
|
||||||
.Returns(new Tuple<Artist, List<Album>>(_fakeArtist, new List<Album>()));
|
.Returns(new Tuple<Artist, List<Album>>(_fakeArtist, new List<Album>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
{
|
{
|
||||||
var newArtist = new Artist
|
var newArtist = new Artist
|
||||||
{
|
{
|
||||||
ForeignArtistId = "123456",
|
ForeignArtistId = "ce09ea31-3d4a-4487-a797-e315175457a0",
|
||||||
RootFolderPath = @"C:\Test\Music"
|
RootFolderPath = @"C:\Test\Music"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
{
|
{
|
||||||
var newArtist = new Artist
|
var newArtist = new Artist
|
||||||
{
|
{
|
||||||
ForeignArtistId = "123456",
|
ForeignArtistId = "ce09ea31-3d4a-4487-a797-e315175457a0",
|
||||||
RootFolderPath = @"C:\Test\Music"
|
RootFolderPath = @"C:\Test\Music"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
{
|
{
|
||||||
var newArtist = new Artist
|
var newArtist = new Artist
|
||||||
{
|
{
|
||||||
ForeignArtistId = "123456",
|
ForeignArtistId = "ce09ea31-3d4a-4487-a797-e315175457a0",
|
||||||
Path = @"C:\Test\Music\Name1"
|
Path = @"C:\Test\Music\Name1"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,12 +108,12 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
{
|
{
|
||||||
var newArtist = new Artist
|
var newArtist = new Artist
|
||||||
{
|
{
|
||||||
ForeignArtistId = "123456",
|
ForeignArtistId = "ce09ea31-3d4a-4487-a797-e315175457a0",
|
||||||
Path = @"C:\Test\Music\Name1"
|
Path = @"C:\Test\Music\Name1"
|
||||||
};
|
};
|
||||||
|
|
||||||
Mocker.GetMock<IProvideArtistInfo>()
|
Mocker.GetMock<IProvideArtistInfo>()
|
||||||
.Setup(s => s.GetArtistInfo(newArtist.ForeignArtistId))
|
.Setup(s => s.GetArtistInfo(newArtist.ForeignArtistId, newArtist.PrimaryAlbumTypes, newArtist.SecondaryAlbumTypes))
|
||||||
.Throws(new ArtistNotFoundException(newArtist.ForeignArtistId));
|
.Throws(new ArtistNotFoundException(newArtist.ForeignArtistId));
|
||||||
|
|
||||||
Mocker.GetMock<IAddArtistValidator>()
|
Mocker.GetMock<IAddArtistValidator>()
|
||||||
|
@ -128,4 +128,4 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
ExceptionVerification.ExpectedErrors(1);
|
ExceptionVerification.ExpectedErrors(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,14 +38,14 @@ namespace NzbDrone.Core.Test.MusicTests
|
||||||
.Returns(_artist);
|
.Returns(_artist);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideArtistInfo>()
|
Mocker.GetMock<IProvideArtistInfo>()
|
||||||
.Setup(s => s.GetArtistInfo(It.IsAny<string>()))
|
.Setup(s => s.GetArtistInfo(It.IsAny<string>(), It.IsAny<List<string>>(), It.IsAny<List<string>>()))
|
||||||
.Callback<string>(p => { throw new ArtistNotFoundException(p); });
|
.Callback(() => { throw new ArtistNotFoundException(_artist.ForeignArtistId); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenNewArtistInfo(Artist artist)
|
private void GivenNewArtistInfo(Artist artist)
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IProvideArtistInfo>()
|
Mocker.GetMock<IProvideArtistInfo>()
|
||||||
.Setup(s => s.GetArtistInfo(_artist.ForeignArtistId))
|
.Setup(s => s.GetArtistInfo(_artist.ForeignArtistId, _artist.PrimaryAlbumTypes, _artist.SecondaryAlbumTypes))
|
||||||
.Returns(new Tuple<Artist, List<Album>>(artist, new List<Album>()));
|
.Returns(new Tuple<Artist, List<Album>>(artist, new List<Album>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(121)]
|
||||||
|
public class update_types_existing_artist : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Execute.Sql("UPDATE Artists SET PrimaryAlbumTypes = '[]', SecondaryAlbumTypes = '[]'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -6,6 +6,6 @@ namespace NzbDrone.Core.MetadataSource
|
||||||
{
|
{
|
||||||
public interface IProvideArtistInfo
|
public interface IProvideArtistInfo
|
||||||
{
|
{
|
||||||
Tuple<Artist, List<Album>> GetArtistInfo(string lidarrId);
|
Tuple<Artist, List<Album>> GetArtistInfo(string lidarrId, List<string> primaryAlbumTypes, List<string> secondaryAlbumTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tuple<Artist, List<Album>> GetArtistInfo(string foreignArtistId)
|
public Tuple<Artist, List<Album>> GetArtistInfo(string foreignArtistId, List<string> primaryAlbumTypes, List<string> secondaryAlbumTypes)
|
||||||
{
|
{
|
||||||
|
|
||||||
_logger.Debug("Getting Artist with LidarrAPI.MetadataID of {0}", foreignArtistId);
|
_logger.Debug("Getting Artist with LidarrAPI.MetadataID of {0}", foreignArtistId);
|
||||||
|
@ -46,10 +46,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
var httpRequest = customerRequestBuilder.Create()
|
var httpRequest = customerRequestBuilder.Create()
|
||||||
.SetSegment("route", "artists/" + foreignArtistId)
|
.SetSegment("route", "artists/" + foreignArtistId)
|
||||||
|
.AddQueryParam("primTypes", string.Join("|",primaryAlbumTypes))
|
||||||
|
.AddQueryParam("secTypes", string.Join("|", secondaryAlbumTypes))
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
httpRequest.AllowAutoRedirect = true;
|
httpRequest.AllowAutoRedirect = true;
|
||||||
httpRequest.SuppressHttpError = true;
|
httpRequest.SuppressHttpError = true;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new List<Artist> { GetArtistInfo(slug).Item1 };
|
return new List<Artist> { GetArtistInfo(slug, new List<string>{"Album"}, new List<string>{"Studio"}).Item1 };
|
||||||
}
|
}
|
||||||
catch (ArtistNotFoundException)
|
catch (ArtistNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Music
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tuple = _artistInfo.GetArtistInfo(newArtist.ForeignArtistId);
|
tuple = _artistInfo.GetArtistInfo(newArtist.ForeignArtistId, newArtist.PrimaryAlbumTypes, newArtist.SecondaryAlbumTypes);
|
||||||
}
|
}
|
||||||
catch (ArtistNotFoundException)
|
catch (ArtistNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace NzbDrone.Core.Music
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public string Disambiguation { get; set; }
|
public string Disambiguation { get; set; }
|
||||||
public string ArtistType { get; set; }
|
public string ArtistType { get; set; }
|
||||||
public string PrimaryAlbumTypes { get; set; }
|
public List<string> PrimaryAlbumTypes { get; set; }
|
||||||
public string SecondaryAlbumTypes { get; set; }
|
public List<string> SecondaryAlbumTypes { get; set; }
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public bool AlbumFolder { get; set; }
|
public bool AlbumFolder { get; set; }
|
||||||
public DateTime? LastInfoSync { get; set; }
|
public DateTime? LastInfoSync { get; set; }
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Music
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tuple = _artistInfo.GetArtistInfo(artist.ForeignArtistId);
|
tuple = _artistInfo.GetArtistInfo(artist.ForeignArtistId, artist.PrimaryAlbumTypes, artist.SecondaryAlbumTypes);
|
||||||
}
|
}
|
||||||
catch (ArtistNotFoundException)
|
catch (ArtistNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,6 +252,7 @@
|
||||||
<Compile Include="Datastore\Migration\068_add_release_restrictions.cs" />
|
<Compile Include="Datastore\Migration\068_add_release_restrictions.cs" />
|
||||||
<Compile Include="Datastore\Migration\069_quality_proper.cs" />
|
<Compile Include="Datastore\Migration\069_quality_proper.cs" />
|
||||||
<Compile Include="Datastore\Migration\070_delay_profile.cs" />
|
<Compile Include="Datastore\Migration\070_delay_profile.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\121_update_types_existing_artist.cs" />
|
||||||
<Compile Include="Datastore\Migration\102_add_language_to_episodeFiles_history_and_blacklist.cs" />
|
<Compile Include="Datastore\Migration\102_add_language_to_episodeFiles_history_and_blacklist.cs" />
|
||||||
<Compile Include="Datastore\Migration\110_fix_extra_files_config.cs" />
|
<Compile Include="Datastore\Migration\110_fix_extra_files_config.cs" />
|
||||||
<Compile Include="Datastore\Migration\109_import_extra_files.cs" />
|
<Compile Include="Datastore\Migration\109_import_extra_files.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue