|
|
@ -276,11 +276,10 @@ class EventsSync(SheetSync):
|
|
|
|
"category",
|
|
|
|
"category",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, name, middleware, stop, dbmanager, reverse_sync=False, media_dir=None, shifts=None):
|
|
|
|
def __init__(self, name, middleware, stop, dbmanager, reverse_sync=False, media_dir=None):
|
|
|
|
super().__init__(name, middleware, stop, dbmanager, reverse_sync)
|
|
|
|
super().__init__(name, middleware, stop, dbmanager, reverse_sync)
|
|
|
|
self.media_dir = media_dir
|
|
|
|
self.media_dir = media_dir
|
|
|
|
self.media_downloads = None if media_dir is None else {}
|
|
|
|
self.media_downloads = None if media_dir is None else {}
|
|
|
|
self.shifts = shifts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def observe_rows(self, rows):
|
|
|
|
def observe_rows(self, rows):
|
|
|
@ -482,12 +481,18 @@ def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0, media_dir=
|
|
|
|
client_secret=creds['client_secret'],
|
|
|
|
client_secret=creds['client_secret'],
|
|
|
|
refresh_token=creds['refresh_token'],
|
|
|
|
refresh_token=creds['refresh_token'],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if config["type"] in ("events", "archive"):
|
|
|
|
if config["type"] == "events":
|
|
|
|
middleware_cls = {
|
|
|
|
middleware = SheetsEventsMiddleware(
|
|
|
|
"events": SheetsEventsMiddleware,
|
|
|
|
client,
|
|
|
|
"archive": SheetsArchiveMiddleware,
|
|
|
|
config["sheet_id"],
|
|
|
|
}[config["type"]]
|
|
|
|
config["worksheets"],
|
|
|
|
middleware = middleware_cls(
|
|
|
|
common.dateutil.parse(config["bustime_start"]),
|
|
|
|
|
|
|
|
config["edit_url"],
|
|
|
|
|
|
|
|
shifts,
|
|
|
|
|
|
|
|
allocate_ids,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
elif config["type"] == "archive":
|
|
|
|
|
|
|
|
middleware = SheetsArchiveMiddleware(
|
|
|
|
client,
|
|
|
|
client,
|
|
|
|
config["sheet_id"],
|
|
|
|
config["sheet_id"],
|
|
|
|
config["worksheets"],
|
|
|
|
config["worksheets"],
|
|
|
@ -528,8 +533,6 @@ def main(dbconnect, sync_configs, metrics_port=8005, backdoor_port=0, media_dir=
|
|
|
|
"archive": ArchiveSync,
|
|
|
|
"archive": ArchiveSync,
|
|
|
|
}[config["type"]]
|
|
|
|
}[config["type"]]
|
|
|
|
sync_class_kwargs = {}
|
|
|
|
sync_class_kwargs = {}
|
|
|
|
if config["type"] == "events":
|
|
|
|
|
|
|
|
sync_class_kwargs["shifts"] = shifts
|
|
|
|
|
|
|
|
if config["type"] == "events" and config.get("download_media", False):
|
|
|
|
if config["type"] == "events" and config.get("download_media", False):
|
|
|
|
sync_class_kwargs["media_dir"] = media_dir
|
|
|
|
sync_class_kwargs["media_dir"] = media_dir
|
|
|
|
sync = sync_class(config["name"], middleware, stop, dbmanager, reverse_sync, **sync_class_kwargs)
|
|
|
|
sync = sync_class(config["name"], middleware, stop, dbmanager, reverse_sync, **sync_class_kwargs)
|
|
|
|