New: Release Profiles, Frontend updates (#580)

* New: Release Profiles - UI Updates

* New: Release Profiles - API Changes

* New: Release Profiles - Test Updates

* New: Release Profiles - Backend Updates

* New: Interactive Artist Search

* New: Change Montiored on Album Details Page

* New: Show Duration on Album Details Page

* Fixed: Manual Import not working if no albums are Missing

* Fixed: Sort search input by sortTitle

* Fixed: Queue columnLabel throwing JS error
This commit is contained in:
Qstick
2019-02-23 17:39:11 -05:00
committed by GitHub
parent f126eafd26
commit 3f064c94b9
409 changed files with 6882 additions and 3176 deletions
@@ -7,6 +7,7 @@ using NzbDrone.Core.Profiles.Delay;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Profiles.Releases;
namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
@@ -16,18 +17,21 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
private readonly IUpgradableSpecification _upgradableSpecification;
private readonly IDelayProfileService _delayProfileService;
private readonly IMediaFileService _mediaFileService;
private readonly IPreferredWordService _preferredWordServiceCalculator;
private readonly Logger _logger;
public DelaySpecification(IPendingReleaseService pendingReleaseService,
IUpgradableSpecification qualityUpgradableSpecification,
IDelayProfileService delayProfileService,
IMediaFileService mediaFileService,
IPreferredWordService preferredWordServiceCalculator,
Logger logger)
{
_pendingReleaseService = pendingReleaseService;
_upgradableSpecification = qualityUpgradableSpecification;
_delayProfileService = delayProfileService;
_mediaFileService = mediaFileService;
_preferredWordServiceCalculator = preferredWordServiceCalculator;
_logger = logger;
}
@@ -42,7 +46,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
return Decision.Accept();
}
var profile = subject.Artist.Profile.Value;
var qualityProfile = subject.Artist.QualityProfile.Value;
var languageProfile = subject.Artist.LanguageProfile.Value;
var delayProfile = _delayProfileService.BestForTags(subject.Artist.Tags);
var delay = delayProfile.GetProtocolDelay(subject.Release.DownloadProtocol);
@@ -54,8 +58,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
return Decision.Accept();
}
var comparer = new QualityModelComparer(profile);
var comparerLanguage = new LanguageComparer(languageProfile);
var qualityComparer = new QualityModelComparer(qualityProfile);
var languageComparer = new LanguageComparer(languageProfile);
if (isPreferredProtocol)
{
@@ -66,12 +70,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
if (trackFiles.Any())
{
var lowestQuality = trackFiles.Select(c => c.Quality).OrderBy(c => c.Quality.Id).First();
var upgradable = _upgradableSpecification.IsUpgradable(profile,
var upgradable = _upgradableSpecification.IsUpgradable(qualityProfile,
languageProfile,
lowestQuality,
trackFiles[0].Language,
_preferredWordServiceCalculator.Calculate(subject.Artist, trackFiles[0].GetSceneOrFileName()),
subject.ParsedAlbumInfo.Quality,
subject.ParsedAlbumInfo.Language);
subject.ParsedAlbumInfo.Language,
subject.PreferredWordScore);
if (upgradable)
{
_logger.Debug("New quality is a better revision for existing quality, skipping delay");
@@ -82,9 +88,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
}
// If quality meets or exceeds the best allowed quality in the profile accept it immediately
var bestQualityInProfile = profile.LastAllowedQuality();
var isBestInProfile = comparer.Compare(subject.ParsedAlbumInfo.Quality.Quality, bestQualityInProfile) >= 0;
var isBestInProfileLanguage = comparerLanguage.Compare(subject.ParsedAlbumInfo.Language, languageProfile.LastAllowedLanguage()) >= 0;
var bestQualityInProfile = qualityProfile.LastAllowedQuality();
var isBestInProfile = qualityComparer.Compare(subject.ParsedAlbumInfo.Quality.Quality, bestQualityInProfile) >= 0;
var isBestInProfileLanguage = languageComparer.Compare(subject.ParsedAlbumInfo.Language, languageProfile.LastAllowedLanguage()) >= 0;
if (isBestInProfile && isBestInProfileLanguage && isPreferredProtocol)
{
@@ -5,6 +5,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.History;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles.Releases;
namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
@@ -13,16 +14,19 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
private readonly IHistoryService _historyService;
private readonly UpgradableSpecification _upgradableSpecification;
private readonly IConfigService _configService;
private readonly IPreferredWordService _preferredWordServiceCalculator;
private readonly Logger _logger;
public HistorySpecification(IHistoryService historyService,
UpgradableSpecification qualityUpgradableSpecification,
IConfigService configService,
IPreferredWordService preferredWordServiceCalculator,
Logger logger)
{
_historyService = historyService;
_upgradableSpecification = qualityUpgradableSpecification;
_configService = configService;
_preferredWordServiceCalculator = preferredWordServiceCalculator;
_logger = logger;
}
@@ -48,8 +52,28 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
if (mostRecent != null && mostRecent.EventType == HistoryEventType.Grabbed)
{
var recent = mostRecent.Date.After(DateTime.UtcNow.AddHours(-12));
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(subject.Artist.Profile, subject.Artist.LanguageProfile, mostRecent.Quality, mostRecent.Language, subject.ParsedAlbumInfo.Quality);
var upgradeable = _upgradableSpecification.IsUpgradable(subject.Artist.Profile, subject.Artist.LanguageProfile, mostRecent.Quality, mostRecent.Language, subject.ParsedAlbumInfo.Quality, subject.ParsedAlbumInfo.Language);
// The artist will be the same as the one in history since it's the same episode.
// Instead of fetching the series from the DB reuse the known series.
var preferredWordScore = _preferredWordServiceCalculator.Calculate(subject.Artist, mostRecent.SourceTitle);
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(
subject.Artist.QualityProfile,
subject.Artist.LanguageProfile,
mostRecent.Quality,
mostRecent.Language,
preferredWordScore,
subject.ParsedAlbumInfo.Quality,
subject.PreferredWordScore);
var upgradeable = _upgradableSpecification.IsUpgradable(
subject.Artist.QualityProfile,
subject.Artist.LanguageProfile,
mostRecent.Quality,
mostRecent.Language,
preferredWordScore,
subject.ParsedAlbumInfo.Quality,
subject.ParsedAlbumInfo.Language,
subject.PreferredWordScore);
if (!recent && cdhEnabled)
{
@@ -30,7 +30,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
if (!subject.Artist.Monitored)
{
_logger.Debug("{0} is present in the DB but not tracked. skipping.", subject.Artist);
_logger.Debug("{0} is present in the DB but not tracked. Rejecting.", subject.Artist);
return Decision.Reject("Artist is not monitored");
}
@@ -40,7 +40,21 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
return Decision.Accept();
}
_logger.Debug("Only {0}/{1} albums are monitored. skipping.", monitoredCount, subject.Albums.Count);
if (subject.Albums.Count == 1)
{
_logger.Debug("Album is not monitored. Rejecting", monitoredCount, subject.Albums.Count);
return Decision.Reject("Album is not monitored");
}
if (monitoredCount == 0)
{
_logger.Debug("No albums in the release are monitored. Rejecting", monitoredCount, subject.Albums.Count);
}
else
{
_logger.Debug("Only {0}/{1} albums in the release are monitored. Rejecting", monitoredCount, subject.Albums.Count);
}
return Decision.Reject("Album is not monitored");
}
}