Add upload feature
This commit is contained in:
parent
0880e89610
commit
c4b83aae54
2 changed files with 89 additions and 3 deletions
|
|
@ -9,9 +9,13 @@ if [[ "$pid" ]]; then
|
||||||
else
|
else
|
||||||
filename="/home/jose/Pictures/Screenshots/$(date '+%Y-%m-%d_%I:%M:%S%p')"
|
filename="/home/jose/Pictures/Screenshots/$(date '+%Y-%m-%d_%I:%M:%S%p')"
|
||||||
# Start the screen recording in the region defined by Slurp
|
# Start the screen recording in the region defined by Slurp
|
||||||
screen_region=$(slurp -b '#00000090')
|
# If you hit cancel the slurp, we need to handle that.
|
||||||
|
if ! screen_region=$(slurp -b '#00000090'); then
|
||||||
|
notify-send -a 'Screen Recording' 'Cancelled!'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
# Now that we've shown the area, play the screenrec sound as a trigger
|
# Now that we've shown the area, play the screenrec sound as a trigger
|
||||||
paplay $(dirname "$(realpath $0)")/screenrec.wav
|
paplay $(dirname "$(realpath $0)")/screenrec.wav --volume 655350
|
||||||
# Finally start recording
|
# Finally start recording
|
||||||
wf-recorder -g "$screen_region" -f "$filename.mkv"
|
wf-recorder -g "$screen_region" -f "$filename.mkv"
|
||||||
# Convert to MP4 - mp4 breaks if you kill-9 it, but mkv doesn't. Keep benefits of both
|
# Convert to MP4 - mp4 breaks if you kill-9 it, but mkv doesn't. Keep benefits of both
|
||||||
|
|
@ -19,7 +23,7 @@ else
|
||||||
# Copy the output file to the clipboard
|
# Copy the output file to the clipboard
|
||||||
wl-copy file://"$filename.mp4" -t text/uri-list
|
wl-copy file://"$filename.mp4" -t text/uri-list
|
||||||
# Now we can say the recording is done - replace the existing notif
|
# Now we can say the recording is done - replace the existing notif
|
||||||
notify-send -a 'Screen Recording' 'Screen Recording Saved!'
|
notify-send -a 'Screen Recording' 'Saved + Copied to Clipboard'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
82
linux/upload
Executable file
82
linux/upload
Executable file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Source - https://stackoverflow.com/a/7069755
|
||||||
|
# Posted by Flexo - Save the data dump, modified by community. See post 'Timeline' for change history
|
||||||
|
# Retrieved 2026-06-20, License - CC BY-SA 4.0
|
||||||
|
|
||||||
|
USERNAME="$COPY_PARTY_USERNAME"
|
||||||
|
PASSWORD="$COPY_PARTY_PASSWORD"
|
||||||
|
ROOT="https://stuff.forgeserv.cloud/Jose's%20Junk"
|
||||||
|
FILE=""
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
echo "upload - push a file to CopyParty"
|
||||||
|
echo " Supports deep searching (searching all files within the jar) and regex"
|
||||||
|
echo " "
|
||||||
|
echo "Usage:"
|
||||||
|
echo " upload <file_path> [-u|--user] [-p|--password] [-r|--root]"
|
||||||
|
echo " "
|
||||||
|
echo "options:"
|
||||||
|
echo "-u, --user Define the user for BasicAuth. Defaults to COPY_PARTY_USERNAME"
|
||||||
|
echo "-p, --password Define the password for BasicAuth. Defaults to COPY_PARTY_PASSWORD"
|
||||||
|
echo "-r, --root Define the root for the upload. Defaults to $ROOT"
|
||||||
|
echo "-h, --help Show this prompt"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-u|--user)
|
||||||
|
shift
|
||||||
|
if test $# -gt 0; then
|
||||||
|
export USERNAME=$1
|
||||||
|
else
|
||||||
|
echo "No username defined!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--password)
|
||||||
|
shift
|
||||||
|
if test $# -gt 0; then
|
||||||
|
export PASSWORD=$1
|
||||||
|
else
|
||||||
|
echo "No password defined!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-r|--root)
|
||||||
|
shift
|
||||||
|
if test $# -gt 0; then
|
||||||
|
export ROOT=$1
|
||||||
|
else
|
||||||
|
echo "No alt root specified!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if test -z "$FILE"; then
|
||||||
|
export FILE=$1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "Only one file can be provided!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if test -z "$FILE"; then
|
||||||
|
echo "No file was provided!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
full_url=$(printf '%s/%s?j' "$ROOT" "$FILE")
|
||||||
|
output=$(curl -u "$USERNAME:$PASSWORD" -T "$FILE" "$full_url" 2>/dev/null)
|
||||||
|
fileurl=$(jq -r '.fileurl' <<<"$output")
|
||||||
|
|
||||||
|
echo "$fileurl" | wl-copy
|
||||||
|
notify-send -a 'Uploaded to Copyparty' 'Link Copied to Clipboard!'
|
||||||
Loading…
Reference in a new issue