From c6058cbdd0516f85bcf1d4347f308110a28ade93 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sat, 17 Aug 2024 12:47:46 +1000 Subject: [PATCH] sheetsync: Update streamlog playlist middleware with API changes To allow setting playlist name and show_in_description --- sheetsync/sheetsync/streamlog.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sheetsync/sheetsync/streamlog.py b/sheetsync/sheetsync/streamlog.py index 33cda0a..18695e9 100644 --- a/sheetsync/sheetsync/streamlog.py +++ b/sheetsync/sheetsync/streamlog.py @@ -58,19 +58,25 @@ class StreamLogPlaylistsMiddleware(Middleware): def get_rows(self): rows = [] for tag in self.client.get_tags(): - rows.append({ + row = { "id": tag["id"], "sheet_name": self.playlists_worksheet, "_parse_errors": [], # Special case for the "all everything" list, otherwise all playlists have a single tag. "tags": [] if tag["tag"] == "" else [tag["tag"]], - "playlist_id": tag["playlist"], "description": tag["description"], - "name": "unknown", # TODO missing in StreamLog - "show_in_description": False, # TODO missing in StreamLog + "playlist_id": None, + "name": None, + "show_in_description": None, "first_event_id": None, # TODO missing in StreamLog "last_event_id": None, # TODO missing in StreamLog - }) + } + playlist = tag["playlist"] + if playlist is not None: + row["playlist_id"] = playlist["id"] + row["name"] = playlist["title"] + row["show_in_description"] = playlist["shows_in_video_descriptions"] + rows.append(row) return None, rows # writing intentionally not implemented