Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate upload code #773

Merged
merged 13 commits into from
Nov 10, 2021
Merged

Conversation

EricClaeys
Copy link
Collaborator

Merged the upload code from endOfNight.sh into generateForDay.sh since they were doing almost identical things.
Consolidated code in generateForDay.sh into a couple internal functions to further reduce redundancy.
Other consistency and simplification changes.

This output isn't needed - if there's an error the name of the file with the lftp commands will be output.  If lftp was successful user's won't care about that file.
This code was moved from endOfNight.sh here.
It should have been in generateForDay.sh as well, but was accidently never added there, but it doesn't matter since it's now centralized in upload.sh.
Keogram, startrails, and timelapse all had almost identical code to create them and to upload them - they all used the same logic.
This commit moves that logic into "generate" and "upload" functions, resulting in a smaller file with no duplicate code.

NOTE: when looking at the changes in this commit, Git does a poor job - it compares the two new functions to the old keogram code, and there are a bunch of differences.  It doesn't seem to notice that the two functions are new.  If you look at the startrails and timelapse differences it'll be much clearer.
minor change to not use the name "endOfNight_additionalSteps.sh" twice, which slightly improves maintenance if we ever decide to change that file name.
Renamed TIMELAPSE_PARAMETERS and added STARTRAILS_EXTRA_PARAMETERS so they are all consistent.
Add --silent2 to not display the final "If you want to upload..." message, which shouldn't appear when called via endOfNight.sh.
Made a couple minor other changes.
Ended up not needing it, and didn't know how to delete the commit that added it.
No need to check for 0-length files since the saveImage*.sh scripts already did.
Keogram and startrails scripts don't say how many files they are processing, so timelapse shouldn't either.
We don't mention other settings so no need to mention "scale" setting.
Keogram and startrails scripts don't say say files were created, so timelapse shouldn't either.
The name changed in config.sh.repo.  For compatibility, leave the old name in, but delete after 0.8.5.
Moved the "Nasty JQ trick" from endOfNight.sh to generateForDay.sh since that's where the keogram and startrails files are now created.
endOfNight.sh and generateForDay.sh did the same thing for keogram, startrails, and timelapse files, so the code to create and upload those file was moved to generateForDay.sh.  As such, endOfNight.sh is much shorter and there is no longer duplicated code, making maintenance easier.
Further, generateForDay.sh consolidated much of the code into a couple internal functions.
@linuxkidd linuxkidd merged commit d16306d into master Nov 10, 2021
@EricClaeys EricClaeys deleted the Remove-duplicate-generate-upload-code branch November 10, 2021 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants