From 841fac56346ef8d8b9f29276571217162d47f770 Mon Sep 17 00:00:00 2001 From: Riccardo Berto Date: Mon, 1 Mar 2021 15:11:59 +0100 Subject: [PATCH] remove GPX if it's already in the database, too --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 3a1e0dd..f4c8255 100644 --- a/main.py +++ b/main.py @@ -74,6 +74,7 @@ def process_gpx_files(tx: Connection): print(f'Processing {filename}') if list(db.execute(text('select exists(select from training where owner = :owner and filename = :filename)'), dict(owner=owner, filename=filename,),),)[0][0]: + os.remove(filepath) continue with open(filepath) as f: gpx_file = gpxpy.parse(f)