From 167f8e623c35ec95a500dbdeea9014c211a4db1a Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Thu, 31 Oct 2024 18:58:35 -0700 Subject: [PATCH] Changes to support setting default templates based on tags --- postgres/schema.sql | 4 +++- sheetsync/sheetsync/main.py | 1 + sheetsync/sheetsync/sheets.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/postgres/schema.sql b/postgres/schema.sql index abc331e..2d641d5 100644 --- a/postgres/schema.sql +++ b/postgres/schema.sql @@ -155,7 +155,9 @@ CREATE TABLE playlists ( -- because we don't want invalid input to cause integrity errors. -- It's totally safe for these to point to non-existent events, it just does nothing. first_event_id TEXT, - last_event_id TEXT + last_event_id TEXT, + -- name of the thumbnail template to be applied by default to this tag + default_template TEXT NOT NULL DEFAULT '' ); -- This table records time series data gleaned from the bus cam (right now, just the odometer). diff --git a/sheetsync/sheetsync/main.py b/sheetsync/sheetsync/main.py index df2c380..c88e770 100644 --- a/sheetsync/sheetsync/main.py +++ b/sheetsync/sheetsync/main.py @@ -375,6 +375,7 @@ class PlaylistsSync(SheetSync): "first_event_id", "last_event_id", "show_in_description", + "default_template", } diff --git a/sheetsync/sheetsync/sheets.py b/sheetsync/sheetsync/sheets.py index 7d2db4a..3273e1c 100644 --- a/sheetsync/sheetsync/sheets.py +++ b/sheetsync/sheetsync/sheets.py @@ -198,6 +198,7 @@ class SheetsPlaylistsMiddleware(SheetsMiddleware): "name": 2, "playlist_id": 3, "show_in_description": 4, + "default_template": 5, "first_event_id": 6, "last_event_id": 7, "id": 8, @@ -327,6 +328,7 @@ class SheetsEventsMiddleware(SheetsMiddleware): if 'tags' in row_dict: row_dict['tags'] = ( [ + calculate_shift(row_dict['event_start']) row_dict['category'], # category name worksheet, # sheet name ] + (['Poster Moment'] if row_dict['poster_moment'] else [])