]> git.walde.dev - mtrack_to_gpx/commitdiff
Skip conversion if GPX already exists main
authorDustin Walde <redacted>
Tue, 27 Jun 2023 06:54:17 +0000 (23:54 -0700)
committerDustin Walde <redacted>
Tue, 27 Jun 2023 06:54:17 +0000 (23:54 -0700)
mtrack_to_gpx.py

index c32297d82b0e2da7b9044d5b1260ff106b6809aa..e65fcca8026ffe22fcc43a3f879675d1b12a13b4 100644 (file)
@@ -17,6 +17,9 @@ OPTIONS = {
 def convert_file(path_in: str, keywords: List[str]):
     track = track_pb.Track()
     path_out = path.splitext(path_in)[0] + ".gpx"
+    if path.isfile(path_out):
+        print(path_out + " already exists.")
+        return
     with open(path_in, "rb") as file:
         track.ParseFromString(file.read())
         write_gpx_from_mtrack_data(track, path_out, *keywords)