|
|
@ -236,28 +236,30 @@ def get_row(ident):
|
|
|
|
if is_archive:
|
|
|
|
if is_archive:
|
|
|
|
response["allow_holes"] = True
|
|
|
|
response["allow_holes"] = True
|
|
|
|
|
|
|
|
|
|
|
|
# pick default thumbnail template based on start time.
|
|
|
|
|
|
|
|
# pick default frame time as the middle of the video.
|
|
|
|
|
|
|
|
# ignore both if video has no start time yet.
|
|
|
|
|
|
|
|
# or for archive events, no thumbnail.
|
|
|
|
|
|
|
|
DEFAULT_TEMPLATES = [
|
|
|
|
|
|
|
|
"zeta-right",
|
|
|
|
|
|
|
|
"dawnguard-right",
|
|
|
|
|
|
|
|
"alphaflight-right",
|
|
|
|
|
|
|
|
"nightwatch-right",
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
if is_archive:
|
|
|
|
if is_archive:
|
|
|
|
response["thumbnail_mode"] = "NONE"
|
|
|
|
response["thumbnail_mode"] = "NONE"
|
|
|
|
elif response['event_start'] is not None:
|
|
|
|
elif response['event_start'] is not None:
|
|
|
|
start = response['event_start']
|
|
|
|
start = response['event_start']
|
|
|
|
if response['thumbnail_template'] is None:
|
|
|
|
|
|
|
|
# RDPs default to the RDP template. Others use the current shift.
|
|
|
|
# use tags to determine default thumbnail template
|
|
|
|
if response['category'] == "RDP":
|
|
|
|
if response['thumbnail_template'] is None
|
|
|
|
response['thumbnail_template'] = "rdp"
|
|
|
|
conn = app.db_manager.get_conn()
|
|
|
|
else:
|
|
|
|
query = """
|
|
|
|
pst_hour = (start.hour - 8) % 24
|
|
|
|
SELECT name, default_template
|
|
|
|
shift = int(pst_hour / 6)
|
|
|
|
FROM playlists
|
|
|
|
response['thumbnail_template'] = DEFAULT_TEMPLATES[shift]
|
|
|
|
"""
|
|
|
|
|
|
|
|
results = database.query(conn, query)
|
|
|
|
|
|
|
|
default_templates = {}
|
|
|
|
|
|
|
|
for row in results:
|
|
|
|
|
|
|
|
row = row._asdict:
|
|
|
|
|
|
|
|
if row['name'] and row['default_template']:
|
|
|
|
|
|
|
|
default_templates[row['name']] = row['default_template']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for tag in response['tags'][::-1]:
|
|
|
|
|
|
|
|
if tag in default_templates:
|
|
|
|
|
|
|
|
response['thumbnail_template'] = default_templates[tag]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# pick default frame time as the middle of the video.
|
|
|
|
if response['thumbnail_time'] is None:
|
|
|
|
if response['thumbnail_time'] is None:
|
|
|
|
if response['event_end'] is not None:
|
|
|
|
if response['event_end'] is not None:
|
|
|
|
# take full duration, and add half to start to get halfway
|
|
|
|
# take full duration, and add half to start to get halfway
|
|
|
|