sheetsync: pass in event id instead of event name

pull/401/head
Mike Lang 1 year ago committed by Mike Lang
parent cf41f572f5
commit eebfa5885b

@ -193,9 +193,9 @@
// Set to true to enable reverse-sync mode into Sheets, instead of syncing from it.
sheet_reverse_sync:: false,
// The StreamLog server and event to use, or null to disable sync from StreamLog.
// The StreamLog server and event id to use, or null to disable sync from StreamLog.
streamlog_url:: "https://streamlog.example.com",
streamlog_event:: "myevent",
streamlog_event:: "id_goes_here",
// A map from youtube playlist IDs to a list of tags.
// Playlist manager will populate each playlist with all videos which have all those tags.
@ -456,7 +456,7 @@
type: "streamlog",
creds: "/etc/streamlog-token.txt",
url: $.streamlog_url,
event_name: $.streamlog_event,
event_id: $.streamlog_event,
},
local config = std.prune([
if $.sheet_id != null then sync_sheet,

@ -353,7 +353,7 @@ class PlaylistSync:
' type: streamlog',
' creds: path to a file containing the auth key',
' url: The URL of the streamlog server',
' event_name: The name of the streamlog event to sync',
' event_id: The id of the streamlog event to sync',
]),
)
def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0):
@ -417,7 +417,7 @@ def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0):
auth_token = open(config["creds"]).read().strip()
client = StreamLogClient(
config["url"],
config["event_name"],
config["event_id"],
auth_token,
)
middleware = StreamLogMiddleware(client)

@ -8,13 +8,12 @@ from common.dateutil import parse_utc_only
class StreamLogClient():
"""Client for Stream Log server"""
def __init__(self, url, event_name, auth_token):
def __init__(self, url, event_id, auth_token):
self.url = url
self.auth_token = auth_token
self.event_id = event_id
self.session = requests.Session()
self.event_id = self.request("GET", "event_by_name", event_name)["id"]
def get_rows(self):
"""Return a list of rows, where each row is a dict"""
return self.request("GET", "event", self.event_id, "log")

Loading…
Cancel
Save