Min availability (#816)
* availability specification to prevent downloading titles before their release * pull inCinamas status out of js handlebars and set it in SkyHook * minor code improvement * add incinemas to footer * typo * another typo * release date handling * still print cinema date out for announced titles * revert a minor change from before since its unnecessary * early implementation of minimumAvailability --> when does radarr consider a movie "available" should be specified by user default to "Physical release?" this isn't functional yet, but it has a skeleton + comments. I dont know how to have the minimumavailability attribute default to something or to have it actually populate the Movieinfo object could use some help with that * adding another comment for another location that might need to be updated to handle minimumAvailability * the implementation is now function; however, i still need to specify default values for minimumAvailability * missed these changes in the previous commit * fix rounded corners on new field in editmovie dialog * add minimum availability specification to the addMovie page * minor adjustment from last commit * handle the case where minimumavailability has never yet been set nullstring.. if its never been set, default to Released (Physical/Web) represented by integer value 3 * minAvailability specification on NetImport lists * add support for min availability to the movie editor * use enum MovieStatusType values directly makes for cleaner code * need to fix up the migration forgot in last commit * cleaning up code, proper case * erroneous code added in this feature needed to be removed * update "Wanted" page to take into account minimumAvailability * implement preDB minimumAvailability as default.. behaves same as Physical/Web a few comments with TODO for when preDB is implemented * minor adjustment * remove some unused code (leave commented for now) * improve code for minimumavailability and add option for availabilitydelay (but doesnt do anything yet) * improve isAvailable method * clean up and fix helper info on indexer configuration page * add buttons in Wanted/Missing view
parent
731e607666
commit
140a220340
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
{
|
||||
public class AvailabilitySpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly IConfigService _settingsService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public AvailabilitySpecification(IConfigService settingsService, Logger logger)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public RejectionType Type => RejectionType.Permanent;
|
||||
|
||||
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
if (searchCriteria.UserInvokedSearch)
|
||||
{
|
||||
_logger.Debug("Skipping availability check during search");
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
if (!subject.Movie.IsAvailable(_settingsService.AvailabilityDelay))
|
||||
{
|
||||
return Decision.Reject("Movie {0} will only be considered available {1} days after {2}", subject.Movie, _settingsService.AvailabilityDelay, subject.Movie.MinimumAvailability.ToString());
|
||||
}
|
||||
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
if (!searchCriteria.MonitoredEpisodesOnly)
|
||||
{
|
||||
_logger.Debug("Skipping availability check during search");
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
|
||||
/*if (subject.Series.Status != MovieStatusType.Released)
|
||||
{
|
||||
_logger.Debug("{0} is present in the DB but not yet available. skipping.", subject.Series);
|
||||
return Decision.Reject("Series is not yet available");
|
||||
}
|
||||
|
||||
/*var monitoredCount = subject.Episodes.Count(episode => episode.Monitored);
|
||||
if (monitoredCount == subject.Episodes.Count)
|
||||
{
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
_logger.Debug("Only {0}/{1} episodes are monitored. skipping.", monitoredCount, subject.Episodes.Count);*/
|
||||
return Decision.Reject("Episode is not yet available");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<dl class="minimumavailability-tooltip-contents">
|
||||
<dt>Announced</dt>
|
||||
<dd>Consider the movie available after it has been announced</dd>
|
||||
<dt>In Cinemas</dt>
|
||||
<dd>Consider the movie available once it is In Cinemas</dd>
|
||||
<dt>Physical/Web</dt>
|
||||
<dd>Consider the movie available after Physical/Web release</dd>
|
||||
<dt>PreDB</dt>
|
||||
<dd>Consider the movie available if preDB contains at least one entry</dd>
|
||||
</dl>
|
Loading…
Reference in new issue