parent
e05ceb226c
commit
63e01aff8c
|
@ -109,6 +109,24 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_language_upgrade_for_existing_episodeFile_and_quality_is_same_but_lower_revision()
|
||||
{
|
||||
_localEpisode.Episodes = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.EpisodeFileId = 1)
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 2)),
|
||||
Language = Language.English
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_language_upgrade_for_existing_episodeFile_and_quality_is_worse()
|
||||
{
|
||||
|
@ -251,7 +269,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 2))
|
||||
Quality = new QualityModel(Quality.HDTV720p, new Revision(version: 2)),
|
||||
Language = Language.Spanish
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||
}
|
||||
|
||||
var qualityCompare = qualityComparer.Compare(localEpisode.Quality.Quality, episodeFile.Quality.Quality);
|
||||
var languageCompare = languageComparer.Compare(localEpisode.Language, episodeFile.Language);
|
||||
|
||||
if (qualityCompare < 0)
|
||||
{
|
||||
|
@ -44,14 +45,21 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||
return Decision.Reject("Not an upgrade for existing episode file(s)");
|
||||
}
|
||||
|
||||
if (qualityCompare == 0 && downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
||||
|
||||
// Same quality, is not a language upgrade, propers/repacks are preferred and it is not a revision update
|
||||
// This will allow language upgrades of a lower revision to be imported, which are allowed to be grabbed,
|
||||
// they just don't import automatically.
|
||||
|
||||
if (qualityCompare == 0 &&
|
||||
languageCompare <= 0 &&
|
||||
downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
||||
localEpisode.Quality.Revision.CompareTo(episodeFile.Quality.Revision) < 0)
|
||||
{
|
||||
_logger.Debug("This file isn't a quality upgrade for all episodes. Skipping {0}", localEpisode.Path);
|
||||
_logger.Debug("This file isn't a quality revision upgrade for all episodes. Skipping {0}", localEpisode.Path);
|
||||
return Decision.Reject("Not an upgrade for existing episode file(s)");
|
||||
}
|
||||
|
||||
if (languageComparer.Compare(localEpisode.Language, episodeFile.Language) < 0 && qualityCompare == 0)
|
||||
if (languageCompare < 0 && qualityCompare == 0)
|
||||
{
|
||||
_logger.Debug("This file isn't a language upgrade for all episodes. Skipping {0}", localEpisode.Path);
|
||||
return Decision.Reject("Not an upgrade for existing episode file(s)");
|
||||
|
|
Loading…
Reference in New Issue