diff --git a/playlist_manager/playlist_manager/main.py b/playlist_manager/playlist_manager/main.py index a5ff5ec..23eec5e 100644 --- a/playlist_manager/playlist_manager/main.py +++ b/playlist_manager/playlist_manager/main.py @@ -110,7 +110,7 @@ class PlaylistManager(object): [tag.lower() for tag in row.tags], row.first_event_id, row.last_event_id, - ) for row in query(conn, "SELECT playlist_id, tags, first_event_id, last_event_id FROM playlists") + ) for row in query(conn, "SELECT playlist_id, tags, first_event_id, last_event_id FROM playlists WHERE tags IS NOT NULL") } self.dbmanager.put_conn(conn) duplicates = set(playlists) & set(self.static_playlists) diff --git a/postgres/setup.sh b/postgres/setup.sh index 0dc0b2c..2495c50 100644 --- a/postgres/setup.sh +++ b/postgres/setup.sh @@ -142,11 +142,12 @@ CREATE TABLE editors ( ); -- Playlists are communicated to playlist manager via this table. --- Sheetsync will wipe and re-populate this table periodically to match what is in the sheet CREATE TABLE playlists ( playlist_id TEXT PRIMARY KEY, name TEXT NOT NULL, - tags TEXT[] NOT NULL, + -- When tags is NULL, it indicates tags have not been set and so the playlist should + -- match nothing. Conversely, when tags is empty, it indicates the playlist should match everything. + tags TEXT[], first_event_id UUID REFERENCES events(id) ON DELETE SET NULL, last_event_id UUID REFERENCES events(id) ON DELETE SET NULL, show_in_description BOOLEAN NOT NULL diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index 9a25813..6129f9b 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -303,7 +303,7 @@ def update_row(ident, editor=None): playlists = database.query(conn, """ SELECT playlist_id, name, tags FROM playlists - WHERE show_in_description + WHERE show_in_description AND tags IS NOT NULL """) # Filter for matching playlists for this video playlists = [