diff --git a/frontend/src/Settings/MediaManagement/MediaManagement.js b/frontend/src/Settings/MediaManagement/MediaManagement.js
index 6ab1074ab..25c2010d0 100644
--- a/frontend/src/Settings/MediaManagement/MediaManagement.js
+++ b/frontend/src/Settings/MediaManagement/MediaManagement.js
@@ -25,6 +25,12 @@ const allowFingerprintingOptions = [
{ key: 'never', value: 'Never' }
];
+const downloadPropersAndRepacksOptions = [
+ { key: 'preferAndUpgrade', value: 'Prefer and Upgrade' },
+ { key: 'doNotUpgrade', value: 'Do not Upgrade Automatically' },
+ { key: 'doNotPrefer', value: 'Do not Prefer' }
+];
+
const fileDateOptions = [
{ key: 'none', value: 'None' },
{ key: 'albumReleaseDate', value: 'Album Release Date' }
@@ -209,14 +215,23 @@ class MediaManagement extends Component {
isAdvanced={true}
size={sizes.MEDIUM}
>
- Download Propers
+ Propers and Repacks
diff --git a/src/Lidarr.Api.V1/Config/MediaManagementConfigResource.cs b/src/Lidarr.Api.V1/Config/MediaManagementConfigResource.cs
index 072f0f2bc..7be39b3f1 100644
--- a/src/Lidarr.Api.V1/Config/MediaManagementConfigResource.cs
+++ b/src/Lidarr.Api.V1/Config/MediaManagementConfigResource.cs
@@ -1,6 +1,7 @@
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles;
using Lidarr.Http.REST;
+using NzbDrone.Core.Qualities;
namespace Lidarr.Api.V1.Config
{
@@ -8,7 +9,7 @@ namespace Lidarr.Api.V1.Config
{
public bool AutoUnmonitorPreviouslyDownloadedTracks { get; set; }
public string RecycleBin { get; set; }
- public bool AutoDownloadPropers { get; set; }
+ public ProperDownloadTypes DownloadPropersAndRepacks { get; set; }
public bool CreateEmptyArtistFolders { get; set; }
public bool DeleteEmptyFolders { get; set; }
public FileDateType FileDate { get; set; }
@@ -35,7 +36,7 @@ namespace Lidarr.Api.V1.Config
{
AutoUnmonitorPreviouslyDownloadedTracks = model.AutoUnmonitorPreviouslyDownloadedTracks,
RecycleBin = model.RecycleBin,
- AutoDownloadPropers = model.AutoDownloadPropers,
+ DownloadPropersAndRepacks = model.DownloadPropersAndRepacks,
CreateEmptyArtistFolders = model.CreateEmptyArtistFolders,
DeleteEmptyFolders = model.DeleteEmptyFolders,
FileDate = model.FileDate,
diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs
index bcaaabc41..39d2561c0 100644
--- a/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs
+++ b/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs
@@ -17,6 +17,7 @@ using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Profiles.Languages;
using NzbDrone.Core.Test.Languages;
+using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.Test.DecisionEngineTests
{
@@ -411,7 +412,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}
[Test]
- public void should_put_higher_quality_before_lower_allways()
+ public void should_put_higher_quality_before_lower_always()
{
var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_256), Language.French);
var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), Language.German);
@@ -423,5 +424,88 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.MP3_320);
}
+
+
+ [Test]
+ public void should_prefer_higher_score_over_lower_score()
+ {
+ var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC), Language.English);
+ var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC), Language.English);
+
+ remoteAlbum1.PreferredWordScore = 10;
+ remoteAlbum2.PreferredWordScore = 0;
+
+ var decisions = new List();
+ decisions.Add(new DownloadDecision(remoteAlbum1));
+ decisions.Add(new DownloadDecision(remoteAlbum2));
+
+ var qualifiedReports = Subject.PrioritizeDecisions(decisions);
+ qualifiedReports.First().RemoteAlbum.PreferredWordScore.Should().Be(10);
+ }
+
+ [Test]
+ public void should_prefer_proper_over_score_when_download_propers_is_prefer_and_upgrade()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.PreferAndUpgrade);
+
+ var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1)), Language.English);
+ var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2)), Language.English);
+
+ remoteAlbum1.PreferredWordScore = 10;
+ remoteAlbum2.PreferredWordScore = 0;
+
+ var decisions = new List();
+ decisions.Add(new DownloadDecision(remoteAlbum1));
+ decisions.Add(new DownloadDecision(remoteAlbum2));
+
+ var qualifiedReports = Subject.PrioritizeDecisions(decisions);
+ qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(2);
+ }
+
+ [Test]
+ public void should_prefer_proper_over_score_when_download_propers_is_do_not_upgrade()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.DoNotUpgrade);
+
+ var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1)), Language.English);
+ var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2)), Language.English);
+
+ remoteAlbum1.PreferredWordScore = 10;
+ remoteAlbum2.PreferredWordScore = 0;
+
+ var decisions = new List();
+ decisions.Add(new DownloadDecision(remoteAlbum1));
+ decisions.Add(new DownloadDecision(remoteAlbum2));
+
+ var qualifiedReports = Subject.PrioritizeDecisions(decisions);
+ qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(2);
+ }
+
+ [Test]
+ public void should_prefer_score_over_proper_when_download_propers_is_do_not_prefer()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.DoNotPrefer);
+
+ var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1)), Language.English);
+ var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2)), Language.English);
+
+ remoteAlbum1.PreferredWordScore = 10;
+ remoteAlbum2.PreferredWordScore = 0;
+
+ var decisions = new List();
+ decisions.Add(new DownloadDecision(remoteAlbum1));
+ decisions.Add(new DownloadDecision(remoteAlbum2));
+
+ var qualifiedReports = Subject.PrioritizeDecisions(decisions);
+ qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.FLAC);
+ qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(1);
+ qualifiedReports.First().RemoteAlbum.PreferredWordScore.Should().Be(10);
+ }
}
}
diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs
new file mode 100644
index 000000000..c8b5e8335
--- /dev/null
+++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs
@@ -0,0 +1,203 @@
+using System.Collections.Generic;
+using System.Linq;
+using FizzWare.NBuilder;
+using FluentAssertions;
+using NUnit.Framework;
+using NzbDrone.Core.Qualities;
+using NzbDrone.Core.DecisionEngine.Specifications;
+using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Parser.Model;
+using NzbDrone.Core.Music;
+using Moq;
+
+namespace NzbDrone.Core.Test.DecisionEngineTests
+{
+ [TestFixture]
+ public class RepackSpecificationFixture : CoreTest
+ {
+ private ParsedAlbumInfo _parsedAlbumInfo;
+ private List _albums;
+ private List _trackFiles;
+
+ [SetUp]
+ public void Setup()
+ {
+ Mocker.Resolve();
+
+ _parsedAlbumInfo = Builder.CreateNew()
+ .With(p => p.Quality = new QualityModel(Quality.FLAC,
+ new Revision(2, 0, false)))
+ .With(p => p.ReleaseGroup = "Lidarr")
+ .Build();
+
+ _albums = Builder.CreateListOfSize(1)
+ .All()
+ .BuildList();
+
+ _trackFiles = Builder.CreateListOfSize(3)
+ .All()
+ .With(t => t.AlbumId = _albums.First().Id)
+ .BuildList();
+
+ Mocker.GetMock()
+ .Setup(c => c.GetFilesByAlbum(It.IsAny()))
+ .Returns(_trackFiles);
+ }
+
+ [Test]
+ public void should_return_true_if_it_is_not_a_repack()
+ {
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeTrue();
+ }
+
+ [Test]
+ public void should_return_true_if_there_are_is_no_track_files()
+ {
+ Mocker.GetMock()
+ .Setup(c => c.GetFilesByAlbum(It.IsAny()))
+ .Returns(new List());
+
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeTrue();
+ }
+
+ [Test]
+ public void should_return_true_if_is_a_repack_for_a_different_quality()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = "Lidarr"; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.MP3_256); return c; }).ToList();
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeTrue();
+ }
+
+ [Test]
+ public void should_return_true_if_is_a_repack_for_all_existing_files()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = "Lidarr"; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.FLAC); return c; }).ToList();
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeTrue();
+ }
+
+ [Test]
+ public void should_return_false_if_is_a_repack_for_some_but_not_all_trackfiles()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = "Lidarr"; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.FLAC); return c; }).ToList();
+
+ _trackFiles.First().ReleaseGroup = "NotLidarr";
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeFalse();
+ }
+
+
+ [Test]
+ public void should_return_false_if_is_a_repack_for_different_group()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = "NotLidarr"; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.FLAC); return c; }).ToList();
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeFalse();
+ }
+
+
+ [Test]
+ public void should_return_false_if_release_group_for_existing_file_is_unknown()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = ""; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.FLAC); return c; }).ToList();
+
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeFalse();
+ }
+
+ [Test]
+ public void should_return_false_if_release_group_for_release_is_unknown()
+ {
+ _parsedAlbumInfo.Quality.Revision.IsRepack = true;
+ _parsedAlbumInfo.ReleaseGroup = null;
+
+ _trackFiles.Select(c => { c.ReleaseGroup = "Lidarr"; return c; }).ToList();
+ _trackFiles.Select(c => { c.Quality = new QualityModel(Quality.FLAC); return c; }).ToList();
+
+
+ var remoteAlbum = Builder.CreateNew()
+ .With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
+ .With(e => e.Albums = _albums)
+ .Build();
+
+ Subject.IsSatisfiedBy(remoteAlbum, null)
+ .Accepted
+ .Should()
+ .BeFalse();
+ }
+ }
+}
diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs
index 5e6b3ae57..38768fbd5 100644
--- a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs
+++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs
@@ -35,8 +35,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
_firstFile = new TrackFile { Quality = new QualityModel(Quality.FLAC, new Revision(version: 1)), DateAdded = DateTime.Now };
_secondFile = new TrackFile { Quality = new QualityModel(Quality.FLAC, new Revision(version: 1)), DateAdded = DateTime.Now };
- var singleEpisodeList = new List { new Album {}, new Album {} };
- var doubleEpisodeList = new List { new Album {}, new Album {}, new Album {} };
+ var singleAlbumList = new List { new Album {}, new Album {} };
+ var doubleAlbumList = new List { new Album {}, new Album {}, new Album {} };
var fakeArtist = Builder.CreateNew()
@@ -51,14 +51,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
{
Artist = fakeArtist,
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_256, new Revision(version: 2)) },
- Albums = doubleEpisodeList
+ Albums = doubleAlbumList
};
_parseResultSingle = new RemoteAlbum
{
Artist = fakeArtist,
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_256, new Revision(version: 2)) },
- Albums = singleEpisodeList
+ Albums = singleAlbumList
};
}
@@ -67,13 +67,6 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
_firstFile.Quality = new QualityModel(Quality.MP3_192);
}
- private void GivenAutoDownloadPropers()
- {
- Mocker.GetMock()
- .Setup(s => s.AutoDownloadPropers)
- .Returns(true);
- }
-
[Test]
public void should_return_false_when_trackFile_was_added_more_than_7_days_ago()
{
@@ -124,6 +117,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test]
public void should_return_false_when_proper_but_auto_download_propers_is_false()
{
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.DoNotUpgrade);
+
_firstFile.Quality.Quality = Quality.MP3_256;
_firstFile.DateAdded = DateTime.Today;
@@ -133,7 +130,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
[Test]
public void should_return_true_when_trackFile_was_added_today()
{
- GivenAutoDownloadPropers();
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.PreferAndUpgrade);
+
+ _firstFile.Quality.Quality = Quality.MP3_256;
+
+ _firstFile.DateAdded = DateTime.Today;
+ Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue();
+ }
+
+ [Test]
+ public void should_return_true_when_propers_are_not_preferred()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.DoNotPrefer);
_firstFile.Quality.Quality = Quality.MP3_256;
diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeSpecificationFixture.cs
index 9b0141a22..a560b2bec 100644
--- a/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeSpecificationFixture.cs
+++ b/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeSpecificationFixture.cs
@@ -38,17 +38,17 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
private static readonly int NoPreferredWordScore = 0;
- private void GivenAutoDownloadPropers(bool autoDownloadPropers)
+ private void GivenAutoDownloadPropers(ProperDownloadTypes type)
{
Mocker.GetMock()
- .SetupGet(s => s.AutoDownloadPropers)
- .Returns(autoDownloadPropers);
+ .SetupGet(s => s.DownloadPropersAndRepacks)
+ .Returns(type);
}
[Test, TestCaseSource(nameof(IsUpgradeTestCases))]
public void IsUpgradeTest(Quality current, int currentVersion, Quality newQuality, int newVersion, Quality cutoff, bool expected)
{
- GivenAutoDownloadPropers(true);
+ GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);
var profile = new QualityProfile
{
@@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test, TestCaseSource(nameof(IsUpgradeTestCasesLanguages))]
public void IsUpgradeTestLanguage(Quality current, int currentVersion, Language currentLanguage, Quality newQuality, int newVersion, Language newLanguage, Quality cutoff, Language languageCutoff, bool expected)
{
- GivenAutoDownloadPropers(true);
+ GivenAutoDownloadPropers(ProperDownloadTypes.PreferAndUpgrade);
var profile = new QualityProfile
{
@@ -107,9 +107,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}
[Test]
- public void should_return_false_if_proper_and_autoDownloadPropers_is_false()
+ public void should_return_true_if_proper_and_download_propers_is_do_not_download()
{
- GivenAutoDownloadPropers(false);
+ GivenAutoDownloadPropers(ProperDownloadTypes.DoNotUpgrade);
var profile = new QualityProfile
{
@@ -126,13 +126,41 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Subject.IsUpgradable(
profile,
langProfile,
- new List { new QualityModel(Quality.MP3_256, new Revision(version: 2)) },
+ new List { new QualityModel(Quality.MP3_256, new Revision(version: 1)) },
new List { Language.English },
NoPreferredWordScore,
- new QualityModel(Quality.MP3_256, new Revision(version: 1)),
+ new QualityModel(Quality.MP3_256, new Revision(version: 2)),
Language.English,
NoPreferredWordScore)
- .Should().BeFalse();
+ .Should().BeTrue();
+ }
+
+ [Test]
+ public void should_return_false_if_proper_and_autoDownloadPropers_is_do_not_prefer()
+ {
+ GivenAutoDownloadPropers(ProperDownloadTypes.DoNotPrefer);
+
+ var profile = new QualityProfile
+ {
+ Items = Qualities.QualityFixture.GetDefaultQualities(),
+ };
+
+ var langProfile = new LanguageProfile
+ {
+ Languages = LanguageFixture.GetDefaultLanguages(),
+ Cutoff = Language.English
+ };
+
+ Subject.IsUpgradable(
+ profile,
+ langProfile,
+ new List { new QualityModel(Quality.MP3_256, new Revision(version: 1)) },
+ new List { Language.English },
+ NoPreferredWordScore,
+ new QualityModel(Quality.MP3_256, new Revision(version: 2)),
+ Language.English,
+ NoPreferredWordScore)
+ .Should().BeFalse();
}
}
}
diff --git a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/UpgradeSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/UpgradeSpecificationFixture.cs
index b1429b900..7488e91de 100644
--- a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/UpgradeSpecificationFixture.cs
+++ b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Specifications/UpgradeSpecificationFixture.cs
@@ -12,6 +12,7 @@ using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Music;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Profiles.Languages;
+using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
{
@@ -19,6 +20,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
public class UpgradeSpecificationFixture : CoreTest
{
private Artist _artist;
+ private Album _album;
private LocalTrack _localTrack;
[SetUp]
@@ -35,12 +37,15 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
Cutoff = Language.Spanish,
}).Build();
+ _album = Builder.CreateNew().Build();
+
_localTrack = new LocalTrack
{
Path = @"C:\Test\Imagine Dragons\Imagine.Dragons.Song.1.mp3",
Quality = new QualityModel(Quality.MP3_256, new Revision(version: 1)),
Language = Language.Spanish,
- Artist = _artist
+ Artist = _artist,
+ Album = _album
};
}
@@ -215,5 +220,71 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
Subject.IsSatisfiedBy(_localTrack).Accepted.Should().BeFalse();
}
+
+
+ [Test]
+ public void should_return_false_if_not_a_revision_upgrade_and_prefers_propers()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadPropersAndRepacks)
+ .Returns(ProperDownloadTypes.PreferAndUpgrade);
+
+ _localTrack.Tracks = Builder