Browse Source

Improved "too early to search" calculations

pull/1921/head
Ruud 12 years ago
parent
commit
ad3c24f950
  1. 4
      couchpotato/core/plugins/dashboard/main.py
  2. 8
      couchpotato/core/plugins/searcher/main.py

4
couchpotato/core/plugins/dashboard/main.py

@ -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
couchpotato/core/plugins/searcher/main.py

@ -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:

Loading…
Cancel
Save