Skip to content
Snippets Groups Projects
Unverified Commit 95db9617 authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

Initial feature - will review tomorrow :p

parent 67a77100
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ sudo make install
## Optional dependencies
- maim OR scrot (optional, needed for screenshots)
- [ffcast](https://github.com/minos-org/ffcast/) (needed for video recording)
- xclip (optional, needed for clipboard)
- libnotify (optional, needed for notifications)
......@@ -40,10 +41,11 @@ Usage: supload [OPTIONS] [FILE]
Options:
-f Safe for work mode, (uses volkor.me)
-h Show this menu
-d Use custom domain use -d <domain>
-o Automatically open in browser
-s Screenshot mode (maim Selection)
-g Screen Recording Mode (ffcast)
-V Verbose (debug mode)
-v Shows current version of SUpload
Examples:
......@@ -62,6 +64,9 @@ $ supload -fos
# Screenshot and debug output
$ supload -Vs
# Record and Upload video (make sure to press q to end recording (or type ffcast -k in another terminal :p))
$ supload -g
```
## Configuration
......
......@@ -3,7 +3,12 @@
## Uncomment the below settings to override the defaults!
## file naming scheme
#file_format="date +%F-%T.png"
#photo_format="date +%F-%T.png"
#video_format="date +%F-%T.mp4"
## ffmpeg config for screen recording (1st line is cpu, second is nvidia gpu encoding)
#ffmpeg_config="-preset veryfast -vcodec libx264 -tune zerolatency -b:v 3M"
#ffmpeg_config="-preset llhq -vcodec h264_nvenc -tune zerolatency -b:v 3M" # I can't actually test this, because nvidia drivers broke
## directory to save screenshots (To disable file saving, put it in /tmp, where it will be deleted on reboot)
#file_dir="${HOME}/Pictures/screenshots"
......
......@@ -13,7 +13,9 @@ nc='\033[0m'
debug=false
domain="https://volkor.me"
sshot="maim"
file_format="date +%F-%T.png"
photo_format="date +%F-%T.png"
video_format="date +%F-%T.mp4"
ffmpeg_config="-pix_fmt yuv420p -preset ultrafast -vcodec libx264 -tune zerolatency -b:v 3M"
file_dir="${HOME}/Pictures/screenshots"
browser=false
clipboard=true
......@@ -48,6 +50,7 @@ Options:
-h Show this menu
-o Automatically open in browser
-s Screenshot mode (maim Selection)
-g Screen Recording Mode (ffcast)
-V Verbose (debug mode)
-v Shows current version of SUpload
......@@ -128,7 +131,7 @@ upload_finished() {
exit 0
}
while getopts "d:hosvV" opt; do
while getopts "d:hosgvV" opt; do
case $opt in
d)
## TODO: Check if the args are actually set.
......@@ -143,6 +146,9 @@ while getopts "d:hosvV" opt; do
s)
screenshot=true
;;
g)
video=true
;;
V)
debug=true
;;
......@@ -159,9 +165,10 @@ done
file="${*:$OPTIND}"
$debug && echo -e "${r}DEBUG:${nc} OPTIONS: $*"
# Screenshot
if [ "$screenshot" = "true" ] ; then
echo "Click and hold to select screenshot area or click for window."
screen_path="$file_dir/$($file_format)"
screen_path="$file_dir/$($photo_format)"
$debug && echo -e "${r}DEBUG:${nc} SCREEN_PATH: $screen_path"
case $sshot in
......@@ -183,6 +190,19 @@ if [ "$screenshot" = "true" ] ; then
upload_file "${screen_path}"
fi
# Video
if [ "$video" = "true" ] ; then
video_path="$file_dir/$($video_format)"
$debug && echo -e "${r}DEBUG:${nc} VIDEO_PATH: $video_path"
echo -e "${r}WARNING: PRESS ${nc}q${r} to end screen recording!${nc}"
if ! ffcast -s ffmpeg -- "${ffmpeg_config} ${video_path}"; then
echo -e "${r}ERROR:${nc} Failed to take screenshot (ffcast crashed/user exited)"
exit 1
fi
upload_file "${video_path}"
fi
if [ "$1" = "" ] ; then
echo -e "${r}ERROR:${nc} You must supply either STDIN (-) or a file!"
exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment