garmin-connect-export icon indicating copy to clipboard operation
garmin-connect-export copied to clipboard

Saved original filename is based on activity ID

Open cristian5th opened this issue 3 years ago • 7 comments

It is risky to create the original filename based on the contents of the zip file. Actually, Garmin has recently changed this filename.

The proposal is to make a totally new filename based on the activity ID, independently of how Garmin has decided to name the downloaded file.

Solves issue #63

cristian5th avatar Jul 26 '21 11:07 cristian5th

Second commit is to save gcexport.log file into the export directory so all files are located at the same place

cristian5th avatar Jul 26 '21 11:07 cristian5th

Oh, I misread the PR (edited previous comment)!

In any case, if we wanted to take this approach, it would be nice to handle multiple files in the archive as well (see #63).

bxsx avatar May 29 '22 00:05 bxsx

Second commit is to save gcexport.log file into the export directory so all files are located at the same place

Nice improvement. In case this PR would be rejected, I would still vote for cherry-picking this commit.

I'm not sure this is an improvement. If I run the script several times in a row I'd get several log files; I prefer to have only one log file to easily find the logs of all different script executions. But maybe this could be made configurable?

pe-st avatar May 31 '22 14:05 pe-st

How can this be if the filename and folder is the same every execution? What are the names of the different log files that you get with every execution?

cristian5th avatar May 31 '22 14:05 cristian5th

How can this be if the filename and folder is the same every execution? What are the names of the different log files that you get with every execution?

That really depends on your workflow. The default export directory is ./YYYY-MM-DD_garmin_connect_export, i.e. changing every day. And for my tests I often build the the export directory with the suffix `date +%Y-%m-%d_%H-%M-%S`, i.e. a separate directory for every run. So if the logfile is written to the export directory, I get a separate logfile for every execution.

But I agree that for some workflows it might be desirable to have the logfile in the export directory, so I think we should find a suitable command line option. Maybe a flag would be enough to decide between the script and the export directory? Or should we have more options to also allow an OS-dependent place (something like /var/log/...?), but that would need some research on what are the expected places per OS...

pe-st avatar May 31 '22 19:05 pe-st

I can open a new PR so that a new argument --logfile indicates the requested location by the user. The default location would be derived from the --directory. This way you can always add --logfile=. to achieve the current behaviour. Note: this is a breaking change but I think it's okay.

Are you OK with this solution?

bxsx avatar May 31 '22 19:05 bxsx

I can open a new PR so that a new argument --logfile indicates the requested location by the user. The default location would be derived from the --directory. This way you can always add --logfile=. to achieve the current behaviour. Note: this is a breaking change but I think it's okay.

Are you OK with this solution?

Yes, thanks!

pe-st avatar Jun 07 '22 20:06 pe-st