Only show soon and late with no releases
This commit is contained in:
@@ -4,9 +4,10 @@ from couchpotato.core.event import fireEvent
|
|||||||
from couchpotato.core.helpers.variable import splitString, tryInt
|
from couchpotato.core.helpers.variable import splitString, tryInt
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.core.settings.model import Movie, Library, LibraryTitle
|
from couchpotato.core.settings.model import Movie, Library, LibraryTitle, \
|
||||||
|
Release
|
||||||
from sqlalchemy.orm import joinedload_all
|
from sqlalchemy.orm import joinedload_all
|
||||||
from sqlalchemy.sql.expression import asc
|
from sqlalchemy.sql.expression import asc, or_
|
||||||
import random as rndm
|
import random as rndm
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -48,12 +49,14 @@ class Dashboard(Plugin):
|
|||||||
limit = tryInt(splt[0])
|
limit = tryInt(splt[0])
|
||||||
|
|
||||||
# Get all active movies
|
# Get all active movies
|
||||||
active_status = fireEvent('status.get', ['active'], single = True)
|
active_status, ignored_status = fireEvent('status.get', ['active', 'ignored'], single = True)
|
||||||
q = db.query(Movie) \
|
q = db.query(Movie) \
|
||||||
.join(Library) \
|
.join(Library) \
|
||||||
|
.outerjoin(Movie.releases) \
|
||||||
.filter(Movie.status_id == active_status.get('id')) \
|
.filter(Movie.status_id == active_status.get('id')) \
|
||||||
.with_entities(Movie.id, Movie.profile_id, Library.info, Library.year) \
|
.with_entities(Movie.id, Movie.profile_id, Library.info, Library.year) \
|
||||||
.group_by(Movie.id)
|
.group_by(Movie.id) \
|
||||||
|
.filter(or_(Release.id == None, Release.status_id == ignored_status.get('id')))
|
||||||
|
|
||||||
if not random:
|
if not random:
|
||||||
q = q.join(LibraryTitle) \
|
q = q.join(LibraryTitle) \
|
||||||
|
|||||||
Reference in New Issue
Block a user