Skip to content
Snippets Groups Projects
Commit a343c91c authored by David Trattnig's avatar David Trattnig
Browse files

Fallback show info.

parent 8f97401b
No related branches found
No related tags found
No related merge requests found
...@@ -43,8 +43,11 @@ from libraries.base.config import AuraConfig ...@@ -43,8 +43,11 @@ from libraries.base.config import AuraConfig
from modules.base.simpleutil import SimpleUtil from modules.base.simpleutil import SimpleUtil
# Init Config
config = AuraConfig()
# Initialize DB Model and session # Initialize DB Model and session
engine = sa.create_engine(AuraConfig().get_database_uri()) engine = sa.create_engine(config.get_database_uri())
Base = declarative_base() Base = declarative_base()
Base.metadata.bind = engine Base.metadata.bind = engine
...@@ -555,6 +558,27 @@ class TrackService(DB.Model, AuraDatabaseModel): ...@@ -555,6 +558,27 @@ class TrackService(DB.Model, AuraDatabaseModel):
return None return None
@hybrid_property
def show(self):
"""
Retrieves show information based on the related schedule. If no schedule
is available (e.g. when the engine is in a fallback state), then the default
show properties from `AuraConfig` are returned.
"""
show_info = {}
if self.schedule:
show_info["name"] = self.schedule.show_name
show_info["type"] = self.schedule.type
show_info["host"] = self.show_hosts.show_name
elif self.fallback_type == 4:
show_info["name"] = config.get("fallback_show_name")
show_info["type"] = config.get("fallback_show_type")
show_info["host"] = config.get("fallback_show_host")
return show_info
@staticmethod @staticmethod
def select_one(id): def select_one(id):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment