From 8109dfb0b7bda5ea8adb05553cdad99eff902f99 Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Sun, 10 Mar 2019 22:20:24 +0000 Subject: [PATCH 1/4] Fixed: Remove unused GetAlbum following importer rewrite --- src/NzbDrone.Core/Parser/ParsingService.cs | 46 ---------------------- 1 file changed, 46 deletions(-) diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 101592cb4..340bbd7a0 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -18,7 +18,6 @@ namespace NzbDrone.Core.Parser RemoteAlbum Map(ParsedAlbumInfo parsedAlbumInfo, SearchCriteriaBase searchCriteria = null); RemoteAlbum Map(ParsedAlbumInfo parsedAlbumInfo, int artistId, IEnumerable albumIds); List GetAlbums(ParsedAlbumInfo parsedAlbumInfo, Artist artist, SearchCriteriaBase searchCriteria = null); - Album GetAlbum(Artist artist, ParsedTrackInfo parsedTrackInfo); // Music stuff here Album GetLocalAlbum(string filename, Artist artist); @@ -236,50 +235,5 @@ namespace NzbDrone.Core.Parser return tracksInAlbum.Count == 1 ? _albumService.GetAlbum(tracksInAlbum.First().AlbumId) : null; } - - public Album GetAlbum(Artist artist, ParsedTrackInfo parsedTrackInfo) - { - Album album = null; - - if (parsedTrackInfo == null) - { - return null; - } - - if (parsedTrackInfo.ReleaseMBId.IsNotNullOrWhiteSpace()) - { - album = _albumService.FindAlbumByRelease(parsedTrackInfo.ReleaseMBId); - } - - if (album == null && parsedTrackInfo.AlbumTitle.IsNullOrWhiteSpace()) - { - _logger.Debug("Album title could not be parsed for {0}", parsedTrackInfo); - return null; - } - - var cleanAlbumTitle = Parser.CleanAlbumTitle(parsedTrackInfo.AlbumTitle); - _logger.Debug("Cleaning Album title of common matching issues. Cleaned album title is '{0}'", cleanAlbumTitle); - - if (album == null) - { - album = _albumService.FindByTitle(artist.ArtistMetadataId, cleanAlbumTitle); - } - - if (album == null) - { - _logger.Debug("Trying inexact album match for {0}", parsedTrackInfo); - album = _albumService.FindByTitleInexact(artist.ArtistMetadataId, cleanAlbumTitle); - } - - if (album == null) - { - _logger.Debug("Parsed album title not found in Db for {0}", parsedTrackInfo); - return null; - } - - _logger.Debug("Album {0} selected for {1}", album, parsedTrackInfo); - - return album; - } } } From 68b8ccc826612c6353e65b8060cb21b58c145cc6 Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Sun, 10 Mar 2019 22:20:24 +0000 Subject: [PATCH 2/4] Fixed: NullReferenceException in GetAlbums --- .../NzbDrone.Core.Test.csproj | 3 +- .../ParsingServiceTests/GetAlbumsFixture.cs | 38 +++++++++++++++++++ src/NzbDrone.Core/Parser/ParsingService.cs | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetAlbumsFixture.cs diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 4a40c277f..b93803de2 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -362,6 +362,7 @@ + @@ -613,4 +614,4 @@ - \ No newline at end of file + diff --git a/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetAlbumsFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetAlbumsFixture.cs new file mode 100644 index 000000000..4a696478a --- /dev/null +++ b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetAlbumsFixture.cs @@ -0,0 +1,38 @@ +using Moq; +using NUnit.Framework; +using NzbDrone.Core.Parser; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.Music; +using FizzWare.NBuilder; +using NzbDrone.Core.IndexerSearch.Definitions; +using NzbDrone.Core.Parser.Model; +using FluentAssertions; +using System.Linq; +using System.Collections.Generic; + +namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests +{ + [TestFixture] + public class GetAlbumsFixture : CoreTest + { + [Test] + public void should_not_fail_if_search_criteria_contains_multiple_albums_with_the_same_name() + { + var artist = Builder.CreateNew().Build(); + var albums = Builder.CreateListOfSize(2).All().With(x => x.Title = "IdenticalTitle").Build().ToList(); + var criteria = new AlbumSearchCriteria { + Artist = artist, + Albums = albums + }; + + var parsed = new ParsedAlbumInfo { + AlbumTitle = "IdenticalTitle" + }; + + Subject.GetAlbums(parsed, artist, criteria).Should().BeEquivalentTo(new List()); + + Mocker.GetMock() + .Verify(s => s.FindByTitle(artist.ArtistMetadataId, "IdenticalTitle"), Times.Once()); + } + } +} diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 340bbd7a0..f8c658bbf 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -149,7 +149,7 @@ namespace NzbDrone.Core.Parser if (searchCriteria != null) { - albumInfo = searchCriteria.Albums.SingleOrDefault(e => e.Title == albumTitle); + albumInfo = searchCriteria.Albums.ExclusiveOrDefault(e => e.Title == albumTitle); } if (albumInfo == null) From 1c63b04eb38f92d8e77ac656eb5e5d4059c7b2db Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Sun, 10 Mar 2019 22:55:13 +0000 Subject: [PATCH 3/4] Fixed: Make fpcalc version check strict again now lsio updated --- src/NzbDrone.Core/HealthCheck/Checks/FpcalcCheck.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/FpcalcCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/FpcalcCheck.cs index d90f6a0d2..156a4946f 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/FpcalcCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/FpcalcCheck.cs @@ -32,7 +32,7 @@ namespace NzbDrone.Core.HealthCheck.Checks } var fpcalcVersion = _fingerprintingService.FpcalcVersion(); - if (fpcalcVersion == null || fpcalcVersion < new Version("1.2.0")) + if (fpcalcVersion == null || fpcalcVersion < new Version("1.4.3")) { return new HealthCheck(GetType(), HealthCheckResult.Warning, $"You have an old version of fpcalc. Please upgrade to 1.4.3.", "#fpcalc-upgrade"); } From 26d1d78204f53b47b9c56b4eafcd60608a41914f Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Sun, 10 Mar 2019 22:55:13 +0000 Subject: [PATCH 4/4] Fixed: Group sentry NRE events across platforms --- src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index f88173afe..54d2cc337 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -267,7 +267,8 @@ namespace NzbDrone.Common.Instrumentation.Sentry if (message.IsNotNullOrWhiteSpace() && message.Length < 200) { - sentryFingerprint.Add(message); + // Windows gives a trailing '.' for NullReferenceException but mono doesn't + sentryFingerprint.Add(message.TrimEnd('.')); } } }