Kuribo64
Views: 19,981,668 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
04-16-24 09:45 PM
Guest:

0 users reading Auto <s>screenshot</s> anything uploader [linux] | 1 bot

Main - Computers and technology - Auto <s>screenshot</s> anything uploader [linux] Hide post layouts | New reply


Nadia
Posted on 06-05-14 12:20 PM (rev. 4 of 06-15-14 01:23 AM) Link | #42242
Edit: Completely revamped the script. (Yeah, let's start off the post with an edit!)
This new version has the code conveniently split into functions to make it more extensible, it also easily lets you add more things it can do. By default it is able to take and upload screenshots, upload a file you choose from a file picker or paste a file or some text.

Dependencies: gnome-screenshot/scrot/other, notify-send, scp, xclip, zenity

Usage:
  • push.sh screenshot [args] — Take and upload a screenshot. The args are passed to the screenshot tool. Usually you'd want -wb to capture a window and -a to capture an area.
  • push.sh file [name] — Upload a file. If the file name is not specified, a file picker will be opened to let you pick a file.
  • push.sh paste — Paste the current clipboard content to a text file. If the current clipboard content is a file name, the file will be uploaded as if you used the 'file' task.

You can get it here.

The old script:

#!/usr/bin/bash
#
# Script to take a screenshot and scp it to a directory on a host.
# The file name is the current UNIX time in hex.
# After the screenshot has been uploaded, a desktop notification will be
# displayed and the URL will be copied to the clipboard.
#
# The command line arguments are passed to the screenshot tool.
#

# Options
local_temp_directory=/tmp
ssh_host=your-server.com
target_directory="~/screenshots"
url_base="http://your-server.com/screenshots"
screenshot_tool=gnome-screenshot

# Get the file name and take the screenshot
name=$(printf "%x\n" $(date +%s)).png
$screenshot_tool $@ -f $local_temp_directory/$name

# Upload it
scp $local_temp_directory/$name $ssh_host:$target_directory

# Did we succeed?
if [[ $? -eq 0 ]]; then # We did
echo -n $url_base/$name | xclip -selection clipboard -i
notify-send "Screenshot taken" "$url_base/$name" \
--urgency=low \
--hint=int:transient:1
else
notify-send "Screenshot upload failed." \
--hint=int:transient:1
fi

# Delete the temporary file
rm $local_temp_directory/$name

Tahcryon
Posted on 06-05-14 01:38 PM Link | #42244
This is pretty awesome, I'd definitely grab it if I used Linux. How long did this take you to make?

____________________


[04/15/2018]gridatttack: I still think the whole smg2.5 team are still in middle school lol
[04/15/2018]gridatttack: and they are 14yrs old
__________

cosmological: There's no one in Russia who doesn't agree with Putin, probably because his ideas are that great



Nadia
Posted on 06-05-14 01:43 PM Link | #42247
About 20 minutes while also doing something else.

I think you could actually pretty easily modify the script to work on a Mac; I'm guessing there are Mac equivalents of scrot/gnome-screenshot and xclip.

Anthe
Posted on 06-05-14 05:02 PM Link | #42249
Looks cool. Unfortunately I don't use my Linux machine so often but I guess it can be useful :p

____________________
[image]


Main - Computers and technology - Auto <s>screenshot</s> anything uploader [linux] Hide post layouts | New reply

Page rendered in 0.021 seconds. (2048KB of memory used)
MySQL - queries: 28, rows: 115/115, time: 0.008 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.