playlist_manager: Add --once option

pull/407/head
Mike Lang 3 months ago
parent 9d12d37053
commit d8953568b2

@ -437,6 +437,7 @@ def main(
playlists, playlists,
upload_location_allowlist="youtube", upload_location_allowlist="youtube",
interval=600, interval=600,
once=False,
metrics_port=8007, metrics_port=8007,
backdoor_port=0, backdoor_port=0,
): ):
@ -452,6 +453,7 @@ def main(
upload_location. upload_location.
interval is how often to check for new videos, default every 10min. interval is how often to check for new videos, default every 10min.
If --once is given, interval is ignored and we exit after one check.
""" """
common.PromLogCountsHandler.install() common.PromLogCountsHandler.install()
common.install_stacksampler() common.install_stacksampler()
@ -475,6 +477,9 @@ def main(
dbmanager = DBManager(dsn=dbconnect) dbmanager = DBManager(dsn=dbconnect)
manager = PlaylistManager(dbmanager, client, upload_locations, playlists) manager = PlaylistManager(dbmanager, client, upload_locations, playlists)
if once:
manager.run_once()
else:
while not stop.is_set(): while not stop.is_set():
try: try:
manager.run_once() manager.run_once()

Loading…
Cancel
Save