From d8f73ced8c18c975485578e586386f285f521048 Mon Sep 17 00:00:00 2001 From: cristian5th Date: Mon, 26 Jul 2021 12:58:39 +0200 Subject: [PATCH 1/2] Saved filename is based on activity ID --- gcexport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcexport.py b/gcexport.py index 22e51fc..0fe2564 100644 --- a/gcexport.py +++ b/gcexport.py @@ -874,8 +874,8 @@ def export_data_file(activity_id, activity_details, args, file_time, append_desc # sometimes in 2020 Garmin added '_ACTIVITY' to the name in the ZIP. Remove it... # note that 'new_name' should match 'original_basename' elsewhere in this script to # avoid downloading the same files again - name_base = name_base.replace('_ACTIVITY', '') - new_name = os.path.join(directory, prefix + 'activity_' + name_base + append_desc + name_ext) + # name_base = name_base.replace('_ACTIVITY', '') + new_name = original_basename + name_ext logging.debug('renaming %s to %s', unzipped_name, new_name) os.rename(unzipped_name, new_name) if file_time: From cf7d107034cdb17000dfdd56715cf8543eaec061 Mon Sep 17 00:00:00 2001 From: cristian5th Date: Mon, 26 Jul 2021 13:10:04 +0200 Subject: [PATCH 2/2] Save gcexport.log to the export directory --- gcexport.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcexport.py b/gcexport.py index 0fe2564..97f25cb 100644 --- a/gcexport.py +++ b/gcexport.py @@ -888,10 +888,10 @@ def export_data_file(activity_id, activity_details, args, file_time, append_desc # Inform the main program that the file is new return True -def setup_logging(): +def setup_logging(args): """Setup logging""" logging.basicConfig( - filename='gcexport.log', + filename = os.path.join(args.directory, 'gcexport.log'), level=logging.DEBUG, format='%(asctime)s [%(levelname)-7.7s] %(message)s' ) @@ -1117,9 +1117,9 @@ def main(argv): """ Main entry point for gcexport.py """ - setup_logging() - logging.info("Starting %s version %s, using Python version %s", argv[0], SCRIPT_VERSION, python_version()) args = parse_arguments(argv) + setup_logging(args) + logging.info("Starting %s version %s, using Python version %s", argv[0], SCRIPT_VERSION, python_version()) logging_verbosity(args.verbosity) print('Welcome to Garmin Connect Exporter!')