New: Update DB to store all releases for an album (#517)

* New: Store all releases for an album and track artists

* Add Overview, links and release date by release

* Tidy up

* Fix metadata refresh errors following musicbrainz edits
This commit is contained in:
ta264
2018-12-15 00:02:43 +00:00
committed by Qstick
parent 24bdb5a891
commit c392569a63
136 changed files with 2305 additions and 1120 deletions
@@ -3,6 +3,7 @@ using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Music;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.MediaFiles
@@ -13,22 +14,61 @@ namespace NzbDrone.Core.Test.MediaFiles
[Test]
public void get_files_by_artist()
{
var files = Builder<TrackFile>.CreateListOfSize(10)
.All()
.With(c => c.Id = 0)
.With(c => c.Quality =new QualityModel(Quality.MP3_192))
.Random(4)
.With(s => s.ArtistId = 12)
.BuildListOfNew();
Db.InsertMany(files);
Db.All<TrackFile>().Should().HaveCount(10);
var artist = Builder<Artist>.CreateNew()
.With(a => a.ArtistMetadataId = 11)
.With(a => a.Id = 0)
.Build();
Db.Insert(artist);
var artistFiles = Subject.GetFilesByArtist(12);
var album = Builder<Album>.CreateNew()
.With(a => a.Id = 0)
.With(a => a.ArtistMetadataId = artist.ArtistMetadataId)
.Build();
Db.Insert(album);
var release = Builder<AlbumRelease>.CreateNew()
.With(a => a.Id = 0)
.With(a => a.AlbumId = album.Id)
.With(a => a.Monitored = true)
.Build();
Db.Insert(release);
var track = Builder<Track>.CreateListOfSize(10)
.TheFirst(1)
.With(a => a.TrackFileId = files[1].Id)
.TheNext(1)
.With(a => a.TrackFileId = files[2].Id)
.TheNext(1)
.With(a => a.TrackFileId = files[3].Id)
.TheNext(1)
.With(a => a.TrackFileId = files[4].Id)
.TheNext(6)
.With(a => a.TrackFileId = 0)
.All()
.With(a => a.Id = 0)
.With(a => a.AlbumReleaseId = release.Id)
.Build();
Db.InsertMany(track);
Db.All<Artist>().Should().HaveCount(1);
Db.All<Album>().Should().HaveCount(1);
Db.All<Track>().Should().HaveCount(10);
var artistFiles = Subject.GetFilesByArtist(artist.Id);
artistFiles.Should().HaveCount(4);
artistFiles.Should().OnlyContain(c => c.ArtistId == 12);
artistFiles.Should().OnlyContain(c => c.ArtistId == artist.Id);
}
}
}