Simplify coming soon / late listing
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from datetime import date
|
||||
import random as rndm
|
||||
import time
|
||||
|
||||
@@ -48,7 +47,6 @@ class Dashboard(Plugin):
|
||||
active_ids = [x['_id'] for x in fireEvent('media.with_status', 'active', with_doc = False, single = True)]
|
||||
|
||||
medias = []
|
||||
now_year = date.today().year
|
||||
|
||||
if len(active_ids) > 0:
|
||||
|
||||
@@ -70,22 +68,25 @@ class Dashboard(Plugin):
|
||||
|
||||
# Theater quality
|
||||
if pp.get('theater') and fireEvent('movie.searcher.could_be_released', True, eta, media['info']['year'], single = True):
|
||||
coming_soon = True
|
||||
coming_soon = 'theater'
|
||||
elif pp.get('dvd') and fireEvent('movie.searcher.could_be_released', False, eta, media['info']['year'], single = True):
|
||||
coming_soon = True
|
||||
coming_soon = 'dvd'
|
||||
|
||||
if coming_soon:
|
||||
|
||||
# Don't list older movies
|
||||
if ((not late and (media['info']['year'] >= now_year - 1) and (not eta.get('dvd') and not eta.get('theater') or eta.get('dvd') and eta.get('dvd') > (now - 2419200))) or
|
||||
(late and (media['info']['year'] < now_year - 1 or (eta.get('dvd', 0) > 0 or eta.get('theater')) and eta.get('dvd') < (now - 2419200)))):
|
||||
eta_date = eta.get(coming_soon)
|
||||
eta_3month_passed = eta_date < (now - 7862400) # Release was more than 3 months ago
|
||||
|
||||
if (not late and not eta_3month_passed) or \
|
||||
(late and eta_3month_passed):
|
||||
|
||||
add = True
|
||||
|
||||
# Check if it doesn't have any releases
|
||||
if late:
|
||||
media['releases'] = fireEvent('release.for_media', media['_id'], single = True)
|
||||
|
||||
|
||||
for release in media.get('releases'):
|
||||
if release.get('status') in ['snatched', 'available', 'seeding', 'downloaded']:
|
||||
add = False
|
||||
|
||||
Reference in New Issue
Block a user