add upload sound
This commit is contained in:
parent
8378f5b1d6
commit
c037ddc0cd
3 changed files with 29 additions and 3 deletions
15
main.sh
15
main.sh
|
@ -65,6 +65,7 @@ while [[ $# -gt 0 ]]; do
|
|||
--silent)
|
||||
SHOW_NOTIFICATIONS=false
|
||||
SHOW_CAPTURE_PREVIEW=false
|
||||
SNIP_SOUND=false
|
||||
shift
|
||||
;;
|
||||
--*)
|
||||
|
@ -93,6 +94,9 @@ SHOULD_UPLOAD=$(get_value "DEFAULT_OPTION")
|
|||
SHOW_NOTIFICATIONS=$(get_value "SHOW_NOTIFICATIONS")
|
||||
[[ "$SHOW_NOTIFICATIONS" == "true" ]] && SHOW_NOTIFICATIONS=true || SHOW_NOTIFICATIONS=false
|
||||
|
||||
SNIP_SOUND=$(get_value "SNIP_SOUND")
|
||||
[[ "$SNIP_SOUND" == "true" ]] && SNIP_SOUND=true || SNIP_SOUND=false
|
||||
|
||||
SHOW_CAPTURE_PREVIEW=$(get_value "SHOW_CAPTURE_PREVIEW")
|
||||
[[ "$SHOW_CAPTURE_PREVIEW" == "true" ]] && SHOW_CAPTURE_PREVIEW=true || SHOW_CAPTURE_PREVIEW=false
|
||||
|
||||
|
@ -151,6 +155,12 @@ send_notification() {
|
|||
"${notify_cmd[@]}"
|
||||
}
|
||||
|
||||
play_sound() {
|
||||
[[ "$SNIP_SOUND" == "false" ]] && return
|
||||
|
||||
paplay /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
|
||||
}
|
||||
|
||||
SHOULD_UPLOAD=false
|
||||
SHOULD_SAVE="$(get_value "SAVE_IMAGES")"
|
||||
SHOULD_COPY=false
|
||||
|
@ -365,18 +375,21 @@ MIME_TYPE=$(file --mime-type -b "$FILE")
|
|||
if [[ "$MIME_TYPE" == image/* ]]; then
|
||||
if [[ "$SHOW_NOTIFICATIONS" == "true" ]]; then
|
||||
send_notification "Uploaded to $SERVICE" "$FILE_URL" "$FILE"
|
||||
play_sound
|
||||
fi
|
||||
|
||||
if [[ "$SHOW_CAPTURE_PREVIEW" == "true" ]]; then
|
||||
"$PYTHON_EXEC" "$SCRIPT_DIR/helpers/show_image.py" "$FILE" "Uploaded to $SERVICE"
|
||||
play_sound
|
||||
fi
|
||||
else
|
||||
if [[ "$SHOW_NOTIFICATIONS" == "true" ]]; then
|
||||
send_notification "Uploaded to $SERVICE" "$FILE_URL"
|
||||
play_sound
|
||||
fi
|
||||
fi
|
||||
|
||||
# delete if should not save and not a user file
|
||||
if [[ "$SHOULD_SAVE" != "true" && "$USER_FILE" == "" ]]; then
|
||||
rm -f "$FILE"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue