Improved "too early to search" calculations
This commit is contained in:
@@ -70,9 +70,9 @@ class Dashboard(Plugin):
|
||||
coming_soon = False
|
||||
|
||||
# Theater quality
|
||||
if pp.get('theater') and fireEvent('searcher.could_be_released', True, eta, single = True):
|
||||
if pp.get('theater') and fireEvent('searcher.could_be_released', True, eta, movie.library.year, single = True):
|
||||
coming_soon = True
|
||||
if pp.get('dvd') and fireEvent('searcher.could_be_released', False, eta, single = True):
|
||||
if pp.get('dvd') and fireEvent('searcher.could_be_released', False, eta, movie.library.year, single = True):
|
||||
coming_soon = True
|
||||
|
||||
# Skip if movie is snatched/downloaded/available
|
||||
|
||||
@@ -8,6 +8,7 @@ from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from couchpotato.core.settings.model import Movie, Release, ReleaseInfo
|
||||
from couchpotato.environment import Env
|
||||
from datetime import date
|
||||
from inspect import ismethod, isfunction
|
||||
from sqlalchemy.exc import InterfaceError
|
||||
import datetime
|
||||
@@ -164,7 +165,7 @@ class Searcher(Plugin):
|
||||
|
||||
ret = False
|
||||
for quality_type in movie['profile']['types']:
|
||||
if not self.conf('always_search') and not self.couldBeReleased(quality_type['quality']['identifier'] in pre_releases, release_dates):
|
||||
if not self.conf('always_search') and not self.couldBeReleased(quality_type['quality']['identifier'] in pre_releases, release_dates, movie['library']['year']):
|
||||
too_early_to_search.append(quality_type['quality']['identifier'])
|
||||
continue
|
||||
|
||||
@@ -558,11 +559,12 @@ class Searcher(Plugin):
|
||||
|
||||
return False
|
||||
|
||||
def couldBeReleased(self, is_pre_release, dates):
|
||||
def couldBeReleased(self, is_pre_release, dates, year = None):
|
||||
|
||||
now = int(time.time())
|
||||
now_year = date.today().year
|
||||
|
||||
if not dates or (dates.get('theater', 0) == 0 and dates.get('dvd', 0) == 0):
|
||||
if (year is None or year < now_year - 1) and (not dates or (dates.get('theater', 0) == 0 and dates.get('dvd', 0) == 0)):
|
||||
return True
|
||||
else:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user