From: Dustin Walde Date: Tue, 27 Jun 2023 06:54:17 +0000 (-0700) Subject: Skip conversion if GPX already exists X-Git-Url: https://git.walde.dev/?a=commitdiff_plain;h=d4ad88cbf83e69cd10a989f699e082b2b53538c1;p=mtrack_to_gpx Skip conversion if GPX already exists --- diff --git a/mtrack_to_gpx.py b/mtrack_to_gpx.py index c32297d..e65fcca 100644 --- a/mtrack_to_gpx.py +++ b/mtrack_to_gpx.py @@ -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)