Updated to support Album and Track level Compilations

This commit is contained in:
Joseph Milazzo 2017-04-25 07:47:14 -05:00
parent ad23e8ce9f
commit 118e2dfe93
4 changed files with 32 additions and 0 deletions

View File

@ -31,6 +31,8 @@ namespace NzbDrone.Core.Datastore.Migration
Create.TableForModel("Albums")
.WithColumn("AlbumId").AsInt32() // Does this map to collectionId?
.WithColumn("CompilationId").AsInt32()
.WithColumn("Compilation").AsBoolean()
.WithColumn("Title").AsString()
.WithColumn("Year").AsInt32()
.WithColumn("Image").AsInt32() // Is this needed?
@ -41,6 +43,8 @@ namespace NzbDrone.Core.Datastore.Migration
Create.TableForModel("Tracks")
.WithColumn("ItunesTrackId").AsInt32().Unique()
.WithColumn("AlbumId").AsInt32()
.WithColumn("CompilationId").AsInt32().Nullable()
.WithColumn("Compilation").AsBoolean().WithDefaultValue("False")
.WithColumn("TrackNumber").AsInt32()
.WithColumn("Title").AsString().Nullable()
.WithColumn("Ignored").AsBoolean().Nullable()
@ -61,6 +65,10 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Size").AsInt64()
.WithColumn("DateAdded").AsDateTime()
.WithColumn("AlbumId").AsInt32(); // How does this impact stand alone tracks?
Create.TableForModel("Compilation")
.WithColumn("CompilationId").AsInt32().Unique()
.WithColumn("ArtistId").AsString().Nullable();
}
}

View File

@ -112,6 +112,9 @@ namespace NzbDrone.Core.Datastore
.Relationship()
.HasOne(track => track.TrackFile, track => track.TrackFileId);
Mapper.Entity<Compilation>().RegisterModel("Compilation")
.Relationships.AutoMapICollectionOrComplexProperties(); //TODO: Figure out how to map this Table
Mapper.Entity<QualityDefinition>().RegisterModel("QualityDefinitions")
.Ignore(d => d.Weight);

View File

@ -0,0 +1,19 @@
using NzbDrone.Core.Datastore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Music
{
public class Compilation : ModelBase
{
public Compilation()
{
}
public int CompilationId { get; set; }
public LazyList<Artist> Artists { get; set; }
}
}

View File

@ -19,6 +19,8 @@ namespace NzbDrone.Core.Music
public int ItunesTrackId { get; set; }
public int AlbumId { get; set; }
public int CompilationId { get; set; }
public bool Compilation { get; set; }
public int TrackNumber { get; set; }
public string Title { get; set; }
public bool Ignored { get; set; }