From f2a8336b31696395b6736ebca34bbd7fd48631e9 Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Mon, 1 May 2017 21:07:11 -0500 Subject: [PATCH] Search to add DB flow is error free but the artist doesn't add. --- src/NzbDrone.Api/Music/ArtistResource.cs | 2 - .../Datastore/Migration/111_setup_music.cs | 11 +++- src/NzbDrone.Core/Music/AddArtistService.cs | 2 +- src/NzbDrone.Core/Music/Artist.cs | 65 +++++++++++++------ 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/NzbDrone.Api/Music/ArtistResource.cs b/src/NzbDrone.Api/Music/ArtistResource.cs index 92590c381..c42c8f4d7 100644 --- a/src/NzbDrone.Api/Music/ArtistResource.cs +++ b/src/NzbDrone.Api/Music/ArtistResource.cs @@ -110,7 +110,6 @@ namespace NzbDrone.Api.Music ArtistSlug = model.ArtistSlug, RootFolderPath = model.RootFolderPath, - Certification = model.Certification, Genres = model.Genres, Tags = model.Tags, Added = model.Added, @@ -164,7 +163,6 @@ namespace NzbDrone.Api.Music ArtistSlug = resource.ArtistSlug, RootFolderPath = resource.RootFolderPath, - Certification = resource.Certification, Genres = resource.Genres, Tags = resource.Tags, Added = resource.Added, diff --git a/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs b/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs index 48676acb4..0676eb4a9 100644 --- a/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs +++ b/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs @@ -18,17 +18,22 @@ namespace NzbDrone.Core.Datastore.Migration .WithColumn("ArtistSlug").AsString().Unique() .WithColumn("CleanTitle").AsString() // Do we need this? .WithColumn("Monitored").AsBoolean() + .WithColumn("AlbumFolder").AsBoolean() + .WithColumn("ArtistFolder").AsBoolean() .WithColumn("LastInfoSync").AsDateTime().Nullable() .WithColumn("LastDiskSync").AsDateTime().Nullable() .WithColumn("Status").AsInt32() .WithColumn("Path").AsString() .WithColumn("Images").AsString() .WithColumn("QualityProfileId").AsInt32() + .WithColumn("RootFolderPath").AsString() .WithColumn("Added").AsDateTime() - .WithColumn("AddOptions").AsString() - .WithColumn("AlbumFolder").AsInt32() - .WithColumn("Genre").AsString() + .WithColumn("ProfileId").AsInt32() // This is either ProfileId or Profile + .WithColumn("Genres").AsString() .WithColumn("Albums").AsString() + .WithColumn("Tags").AsString() + .WithColumn("AddOptions").AsString() + ; Create.TableForModel("Albums") diff --git a/src/NzbDrone.Core/Music/AddArtistService.cs b/src/NzbDrone.Core/Music/AddArtistService.cs index c6dcf8946..072a67754 100644 --- a/src/NzbDrone.Core/Music/AddArtistService.cs +++ b/src/NzbDrone.Core/Music/AddArtistService.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Music } newArtist.CleanTitle = newArtist.ArtistName.CleanSeriesTitle(); - newArtist.SortTitle = ArtistNameNormalizer.Normalize(newArtist.ArtistName, newArtist.ItunesId); + //newArtist.SortTitle = ArtistNameNormalizer.Normalize(newArtist.ArtistName, newArtist.ItunesId); // There is no Sort Title newArtist.Added = DateTime.UtcNow; var validationResult = _addArtistValidator.Validate(newArtist); diff --git a/src/NzbDrone.Core/Music/Artist.cs b/src/NzbDrone.Core/Music/Artist.cs index 7c8385bfc..2fde7c0ac 100644 --- a/src/NzbDrone.Core/Music/Artist.cs +++ b/src/NzbDrone.Core/Music/Artist.cs @@ -23,41 +23,42 @@ namespace NzbDrone.Core.Music } public int ItunesId { get; set; } - //public int TvRageId { get; set; } - //public int TvMazeId { get; set; } - //public string ImdbId { get; set; } public string ArtistName { get; set; } public string ArtistSlug { get; set; } public string CleanTitle { get; set; } - public string SortTitle { get; set; } - //public SeriesStatusType Status { get; set; } - public string Overview { get; set; } public bool Monitored { get; set; } public bool AlbumFolder { get; set; } + public bool ArtistFolder { get; set; } public DateTime? LastInfoSync { get; set; } - //public int Runtime { get; set; } - public List Images { get; set; } - //public SeriesTypes SeriesType { get; set; } - //public string Network { get; set; } - //public bool UseSceneNumbering { get; set; } - //public string TitleSlug { get; set; } + public DateTime? LastDiskSync { get; set; } + + public int Status { get; set; } // TODO: Figure out what this is, do we need it? public string Path { get; set; } - //public int Year { get; set; } - //public Ratings Ratings { get; set; } + public List Images { get; set; } public List Genres { get; set; } - //public List Actors { get; set; } // MOve to album? - public string Certification { get; set; } + public int QualityProfileId { get; set; } + public string RootFolderPath { get; set; } public DateTime Added { get; set; } - public DateTime? FirstAired { get; set; } public LazyLoaded Profile { get; set; } public int ProfileId { get; set; } - public List Albums { get; set; } public HashSet Tags { get; set; } - public bool ArtistFolder { get; set; } + + public AddSeriesOptions AddOptions { get; set; } - public AddSeriesOptions AddOptions { get; set; } // TODO: Learn what this does + //public string SortTitle { get; set; } + //public SeriesStatusType Status { get; set; } + //public int Runtime { get; set; } + //public SeriesTypes SeriesType { get; set; } + //public string Network { get; set; } + //public bool UseSceneNumbering { get; set; } + //public string TitleSlug { get; set; } + //public int Year { get; set; } + //public Ratings Ratings { get; set; } + //public List Actors { get; set; } // MOve to album? + //public string Certification { get; set; } + //public DateTime? FirstAired { get; set; } public override string ToString() { @@ -66,8 +67,29 @@ namespace NzbDrone.Core.Music public void ApplyChanges(Artist otherArtist) { - //TODO: Implement + ItunesId = otherArtist.ItunesId; + ArtistName = otherArtist.ArtistName; + ArtistSlug = otherArtist.ArtistSlug; + CleanTitle = otherArtist.CleanTitle; + Monitored = otherArtist.Monitored; + AlbumFolder = otherArtist.AlbumFolder; + LastInfoSync = otherArtist.LastInfoSync; + Images = otherArtist.Images; + Path = otherArtist.Path; + Genres = otherArtist.Genres; + RootFolderPath = otherArtist.RootFolderPath; + Added = otherArtist.Added; + Profile = otherArtist.Profile; + ProfileId = otherArtist.ProfileId; + Albums = otherArtist.Albums; + Tags = otherArtist.Tags; + ArtistFolder = otherArtist.ArtistFolder; + AddOptions = otherArtist.AddOptions; + + + //TODO: Implement + ItunesId = otherArtist.ItunesId; Albums = otherArtist.Albums; Path = otherArtist.Path; @@ -80,6 +102,7 @@ namespace NzbDrone.Core.Music RootFolderPath = otherArtist.RootFolderPath; Tags = otherArtist.Tags; AddOptions = otherArtist.AddOptions; + } } }