From 707bbd13b244e6e439803c19d3ca190bc3338190 Mon Sep 17 00:00:00 2001 From: Alessandro Colomba Date: Sat, 9 Feb 2019 11:51:22 -0500 Subject: [PATCH] removes gps data for outdated recordings along with the video --- blackvuesync.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/blackvuesync.py b/blackvuesync.py index f8679dc..d24f03c 100755 --- a/blackvuesync.py +++ b/blackvuesync.py @@ -67,7 +67,7 @@ def set_verbosity(verbosity, is_cron_mode): dry_run = None # keep and cutoff date; only recordings from this date on are downloaded and kept -keep_re = re.compile(r"""(?P\d+)(?P[dw]?)""", re.VERBOSE) +keep_re = re.compile(r"""(?P\d+)(?P[dw]?)""") cutoff_date = None @@ -291,7 +291,19 @@ def prepare_destination(destination): outdated_filepath = os.path.join(destination, outdated_recording.filename) if not dry_run: logger.info("Removing outdated recording : %s", outdated_recording.filename) + + # removes the video recording os.remove(outdated_filepath) + + # removes the gps data for normal recordings + if outdated_recording.type == "N": + gps_filename = "%s_N.gps" % outdated_recording.base_filename + outdated_gps_filepath = os.path.join(destination, gps_filename) + os.remove(outdated_gps_filepath) + + tgf_filename = "%s_N.3gf" % outdated_recording.base_filename + outdated_tgf_filepath = os.path.join(destination, tgf_filename) + os.remove(outdated_tgf_filepath) else: logger.info("DRY RUN Would remove outdated recording : %s", outdated_recording.filename)