-
Notifications
You must be signed in to change notification settings - Fork 173
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
copy_notification_images.sh: expire time #1056
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* New variable NOTIFICATIONFILETYPE to hold ${1} which is the notification type we are to display. * Added LAST_NOTIFICATION_FILE to hold the file name that contains the timestamp and notification type that was last displayed. Subsequent calls to copy_notification_image.sh check if the timestamp on the file is "recent", and if so, skip the current notification.
* Added "_" to $NOTIFICATIONFILETYPE and $NOTIFICATIONFILE * Renamed $RECENTLY to $EXPIRES_IN_SECONDS and made it an optional command-line argument. Some notification messages may want to wait longer than normal, for example, "Restarting" since it can take several seconds to restart. * Renamed $LAST_NOTIFICATION_FILE to $ALLSKY_NOTIFICATION_LOG and moved to variables.sh so allsky.sh can use it. * Improved some comments. * Save Notification_type,expires_in_seconds,expiration_time to log file, not just Notification_type.
* If the passed-in EXPIRES_IN_SECONDS is 0, then force sending the notification, even if we just sent a different one. This will be used by notifications that typically stay for a while, like taking dark frames, non-recoverable error, and not taking pictures during daytime
Since the ALLSKY_NOTIFICATION_LOG now contains all log entries in this session, the name of the file no longer contains "last".
* Created usage_and_exit() function to centralize displaying the usage. * Added "--help" option. * Renamed "NOTIFICATION_FILETYPE" to "NOTIFICATION_TYPE" since it's not a file type. * Changed "expires_in_seconds" from being after the notification type on the command line, to being "--expires seconds". This allowed the next change... * Added ability to create custom notifications when "notification_type" is "custom". The "custom_args" command-line arguments specify the attributes of the notification. allsky.sh and the capture* programs will use that feature in a separate PR.
* Tell generate_notification_images.sh what directory to put the image in
* Use "find" instead of "ls", per shellcheck. * Check for failed "cp".
AndreasLMeg
approved these changes
Mar 25, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine for me. Reviewed but not tested.
After your merge I will update my system und make some testing
Thanks Andreas. I merged it.
Eric
…________________________________
From: AndreasLMeg ***@***.***>
Sent: Friday, March 25, 2022 8:20:10 AM
To: thomasjacquin/allsky ***@***.***>
Cc: EricClaeys ***@***.***>; Author ***@***.***>
Subject: Re: [thomasjacquin/allsky] copy_notification_images.sh: expire time (PR #1056)
@AndreasLMeg approved this pull request.
Looks fine for me. Reviewed but not tested.
After your merge I will update my system und make some testing
—
Reply to this email directly, view it on GitHub<#1056 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AT2PYK7YZLRH6UIEMKNOX43VBW4QVANCNFSM5PWPIZKA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the concept of notification image expiration times, the default being 5 seconds.
If a notification was displayed in the last 5 seconds a new one is to be displayed, don't display it.
For example, if we just displayed "Restarting Allsky" then don't display a "Allsky is starting up" notification because the user likely won't see the "Restarting Allsky" message.
This PR also keeps a log of the notification images displayed. A future PR will have allsky.sh truncate the log so it only lasts through the current Allsky session. This will be more important in the future when the capture programs can be sent a signal to re-read the settings, since that will be done in the same session.
This PR also allows a program calling copy_notification_images.sh to pass in argument to create a custom notification message.
The capture programs and allsky.sh will be modified in a future PR to do this when, for example, the cause of an error is known - it can be displayed in the notification message to better alert the user as to what the problem is. This should aid in support.