mendhak / gpslogger

:satellite: Lightweight GPS Logging Application For Android.
https://gpslogger.app
Other
1.96k stars 606 forks source link

[Feature request] Automatic cleaning of CSV files. 'Allow auto sending' option #1083

Closed LOVE2CMOL closed 2 months ago

LOVE2CMOL commented 1 year ago

If I use CSV queue sending( 'Allow auto sending' option), it will result in the creation of CSV files. If the CSV file has already been recorded with a custom URL, there is no need to save the file on the device. Cleaning can be done automatically without manual intervention.Due to limited storage space on my location device...

Thank you 😊

LOVE2CMOL commented 1 year ago

Alternatively, the CSV file will not be generated if the option to generate CSV files is not selected when using the automatic sending feature to a custom URL.

LOVE2CMOL commented 1 year ago

Perhaps the CSV file generated by selecting the 'Allow auto sending' option can be used as a temp file.

mendhak commented 7 months ago

I don't really have a way to do this cleanly, because the 'auto sending' of URLs is not synchronous with the rest of the application; that means points can be logged to the CSV while at the same time lines from minutes ago are being sent to Custom URL.

A better way to see it is that the Custom URL "auto send" feature is piggybacking off the CSV file logging feature.

I am wondering if it's better to raise a broadcast when a file upload is done, and it could try sending the file name, and a third party application like Llama/Tasker could then delete the file instead.

mendhak commented 7 months ago

I am wondering if it's better to raise a broadcast when a file upload is done, and it could try sending the file name, and a third party application like Llama/Tasker could then delete the file instead.

Ah not straightforward like I thought, many of the uploaders don't know about the file they're dealing with or when they're done, and they're background jobs, so I don't have a reliable way of saying that an upload is complete. (Should have listened to my own comment)

JoannaBurlandBDR commented 6 months ago

Could you have it so the URL job removes the line from the csv file?

Or maybe an option to auto delete after a day/week etc.

I'm currently using this for expense tracking and it's filling up my phones storage and creating a lot of duplicates if I don't manually action it everyday. I am considering using Llama or otherwise but would prefer an all in one.

Thanks for the great app otherwise super happy, I'd contribute if I weren't such an amateur!

mendhak commented 6 months ago

I think it's best to stick to Llama/Tasker for clearing up files. I have had a few requests, but I really don't want to make GPSLogger a file manager, including having it remove entries from files. There's just too much interdependent logic which can go wrong, and it's too destructive to troubleshoot. A lot of the reasoning boils down to GPSLogger being very 'stateless', it writes to a file and actually forgets about it. It has no knowledge of files it's written to in the past.

mendhak commented 6 months ago

Alright, tried once more and I think I have a way to do this.

I can get the app to send a broadcast when a file is uploaded. Tasker or Automate can listen for the broadcast and then choose to delete the file.

This allows the app to continue to be stateless, and it's up to the user to take responsibility for deleting the file.

Example of what the broadcast will look like: https://github.com/mendhak/gpslogger/pull/1126/files#diff-ee93d376b875c680c27e935b59452e931ae71952faf41cc268973e002498b224R78

Just did a quick test in Automate.

image

image

mendhak commented 2 months ago

v131 is in the releases and FDroid

LOVE2CMOL commented 4 days ago

NICE! thanks!