1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00

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
This commit is contained in:
geogolem
2017-02-23 00:03:48 -05:00
committed by Devin Buhl
parent 731e607666
commit 140a220340
38 changed files with 446 additions and 81 deletions
@@ -185,14 +185,71 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
movie.Genres.Add(genre.name);
}
if (resource.status == "Released")
//this is the way it should be handled
//but unfortunately it seems
//tmdb lacks alot of release date info
//omdbapi is actually quite good for this info
//except omdbapi has been having problems recently
//so i will just leave this in as a comment
//and use the 3 month logic that we were using before
/*var now = DateTime.Now;
if (now < movie.InCinemas)
movie.Status = MovieStatusType.Announced;
if (now >= movie.InCinemas)
movie.Status = MovieStatusType.InCinemas;
if (now >= movie.PhysicalRelease)
movie.Status = MovieStatusType.Released;
*/
var now = DateTime.Now;
//handle the case when we have both theatrical and physical release dates
if (movie.InCinemas.HasValue && movie.PhysicalRelease.HasValue)
{
if (now < movie.InCinemas)
movie.Status = MovieStatusType.Announced;
else if (now >= movie.InCinemas)
movie.Status = MovieStatusType.InCinemas;
if (now >= movie.PhysicalRelease)
movie.Status = MovieStatusType.Released;
}
//handle the case when we have theatrical release dates but we dont know the physical release date
else if (movie.InCinemas.HasValue && (now >= movie.InCinemas))
{
movie.Status = MovieStatusType.InCinemas;
}
//handle the case where we only have a physical release date
else if (movie.PhysicalRelease.HasValue && (now >= movie.PhysicalRelease))
{
movie.Status = MovieStatusType.Released;
}
//otherwise the title has only been announced
else
{
movie.Status = MovieStatusType.Announced;
}
//since TMDB lacks alot of information lets assume that stuff is released if its been in cinemas for longer than 3 months.
if (!movie.PhysicalRelease.HasValue && (movie.Status == MovieStatusType.InCinemas) && (((DateTime.Now).Subtract(movie.InCinemas.Value)).TotalSeconds > 60*60*24*30*3))
{
movie.Status = MovieStatusType.Released;
}
//this matches with the old behavior before the creation of the MovieStatusType.InCinemas
/*if (resource.status == "Released")
{
if (movie.InCinemas.HasValue && (((DateTime.Now).Subtract(movie.InCinemas.Value)).TotalSeconds <= 60 * 60 * 24 * 30 * 3))
{
movie.Status = MovieStatusType.InCinemas;
}
else
{
movie.Status = MovieStatusType.Released;
}
}
else
{
movie.Status = MovieStatusType.Announced;
}*/
if (resource.videos != null)
{
@@ -650,6 +707,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
newMovie.ProfileId = movie.ProfileId;
newMovie.Monitored = movie.Monitored;
newMovie.MovieFile = movie.MovieFile;
newMovie.MinimumAvailability = movie.MinimumAvailability;
return newMovie;
}