From 2aa2355c3a5c5f1ef2684682b4d9bcf5e9cfcfef Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 9 Aug 2021 12:10:58 +1000 Subject: [PATCH] minor script improvements --- cut_races.py | 12 ++++++++---- list_races.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cut_races.py b/cut_races.py index d2eb6d7..180b104 100644 --- a/cut_races.py +++ b/cut_races.py @@ -31,7 +31,7 @@ INFO_QUERY = """ def main( output_dir, host='condor.live', user='necrobot-read', password='necrobot-read', database='condor_x2', - base_dir='/srv/wubloader', start_range='0,10', non_interactive=False, + base_dir='/srv/wubloader', start_range='0,10', non_interactive=False, restrict_league=None ): logging.basicConfig(level=logging.INFO) start_range = map(int, start_range.split(",")) @@ -54,6 +54,9 @@ def main( for racer1, racer2, cawmentator, league, match_id, race_number, start, duration in data: base_name = "-".join(map(str, [league, match_id, race_number, racer1, racer2])) + if restrict_league and league != restrict_league: + continue + items = [(racer1, racer1), (racer2, racer2)] if cawmentator: items.append(("caw-{}".format(cawmentator), cawmentator)) @@ -64,16 +67,17 @@ def main( logging.info("Cutting {}, starting at {}".format(output_path, start)) output_temp = "{}.tmp{}.mp4".format(output_path, uuid4()) temp_dir = tempfile.mkdtemp() - caw_kwargs = { + # For cawmentary and grudgedor matches where starts don't make sense, just do -5 to +30. + no_sync_kwargs = { # bypass start checks, cut a longer range instead "output_range": (-5, 30), "time_offset": 0, - } if name.startswith("caw-") else {} + } if name.startswith("caw-") or league == "gru" else {} try: cut_sync_race.cut_race( base_dir, output_temp, temp_dir, stream, start, duration, start_range=start_range, non_interactive=non_interactive, - **caw_kwargs + **no_sync_kwargs ) except cut_sync_race.NoSegments as e: logging.warning(e) diff --git a/list_races.py b/list_races.py index 71654ec..a38a5f7 100644 --- a/list_races.py +++ b/list_races.py @@ -40,7 +40,7 @@ def ts(dt): return dt.strftime("%FT%T") -def main(find1, find2, host='condor.live', user='necrobot-read', password=None, database='condor_xii'): +def main(find1, find2, host='condor.live', user='necrobot-read', password='necrobot-read', database='condor_xii'): logging.basicConfig(level=logging.INFO) if password is None: