From c4b83aae5467820e6cb0b5d450939d31675cba86 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Sat, 4 Jul 2026 12:11:07 -0500 Subject: [PATCH] Add upload feature --- linux/screenrec.sh | 10 ++++-- linux/upload | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 3 deletions(-) create mode 100755 linux/upload diff --git a/linux/screenrec.sh b/linux/screenrec.sh index bf3e2af..60d5d9b 100755 --- a/linux/screenrec.sh +++ b/linux/screenrec.sh @@ -9,9 +9,13 @@ if [[ "$pid" ]]; then else filename="/home/jose/Pictures/Screenshots/$(date '+%Y-%m-%d_%I:%M:%S%p')" # 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 - paplay $(dirname "$(realpath $0)")/screenrec.wav + paplay $(dirname "$(realpath $0)")/screenrec.wav --volume 655350 # Finally start recording 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 @@ -19,7 +23,7 @@ else # Copy the output file to the clipboard wl-copy file://"$filename.mp4" -t text/uri-list # 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 diff --git a/linux/upload b/linux/upload new file mode 100755 index 0000000..c1e3fad --- /dev/null +++ b/linux/upload @@ -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 [-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!'