From b818f4e1af820b3bb26dff1969994b93b9e44ba0 Mon Sep 17 00:00:00 2001 From: cgbsat Date: Tue, 6 Aug 2019 15:05:38 +0000 Subject: [PATCH] Disable auto-scheduling in testing mode (fixes #12) --- schedule_single_station.py | 7 ++++++- utils.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/schedule_single_station.py b/schedule_single_station.py index 3777f6d..39af9b3 100755 --- a/schedule_single_station.py +++ b/schedule_single_station.py @@ -125,6 +125,11 @@ def main(): "than this limit [default: 0.0, maximum: 1.0]", type=float, default=0.) + parser.add_argument("-T", + "--allow-testing", + help="Allow scheduling on stations which are in testing mode [default: False]", + action="store_true") + parser.set_defaults(allow_testing=False) parser.add_argument("-l", "--log-level", default="INFO", @@ -175,7 +180,7 @@ def main(): tmax = tnow + timedelta(hours=length_hours) # Get ground station information - ground_station = get_groundstation_info(ground_station_id) + ground_station = get_groundstation_info(ground_station_id, args.allow_testing) if not ground_station: sys.exit() diff --git a/utils.py b/utils.py index 3a4e34f..0a2c0ca 100644 --- a/utils.py +++ b/utils.py @@ -335,7 +335,7 @@ def get_priority_passes(passes, priorities, favorite_transmitters, only_priority normal.append(satpass) return (priority, normal) -def get_groundstation_info(ground_station_id): +def get_groundstation_info(ground_station_id, allow_testing): logging.info("Requesting information for ground station %d" % ground_station_id) @@ -353,11 +353,15 @@ def get_groundstation_info(ground_station_id): logging.info('Ground station information retrieved!') station = selected_stations[0] - if station['status'] == 'Online' or station['status'] == 'Testing': + if station['status'] == 'Online' or (station['status'] == 'Testing' and allow_testing): return station else: - logging.info("Ground station {} neither in 'online' nor in 'testing' mode, " - "can't schedule!".format(ground_station_id)) + if station['status'] == 'Testing' and not allow_testing: + logging.info("Ground station {} is in testing mode but auto-scheduling is not " + "allowed. Use -T command line argument to enable scheduling.".format(ground_station_id)) + else: + logging.info("Ground station {} neither in 'online' nor in 'testing' mode, " + "can't schedule!".format(ground_station_id)) return {}