tRemoved the broken gif feature - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 5229834db85919d22a9ad184dcff59bf87f8727c
(DIR) parent 1a93d39ffc86acf43f9abcde01e955b1ecfe403d
(HTM) Author: z3bra <willy@mailoo.org>
Date: Tue, 1 Apr 2014 14:29:22 +0200
Removed the broken gif feature
Diffstat:
M instagram | 47 ++++++-------------------------
1 file changed, 9 insertions(+), 38 deletions(-)
---
(DIR) diff --git a/instagram b/instagram
t@@ -7,17 +7,16 @@
# >> http://www.wtfpl.net/txt/copying/
#
-IMAGE_DIR=~/usr/img
-EXEC_UPLOAD=~/bin/upload
-SSHOT_DIR=${IMAGE_DIR}/wm
+VIEWER=meh
+EXEC_UPLOAD=~/bin/imgurup
+SSHOT_DIR=$PWD
WMNAME=`xprop -root WM_NAME|cut -d\" -f2`
-function upload() {
+upload() {
$EXEC_UPLOAD $1
}
-
-function usage() {
+usage() {
cat <<SHBLAH
Usage : instagram [-tmuwh] [-g number] [-s screen] [filename.png]
-t : create thumbnail
t@@ -25,7 +24,6 @@ Usage : instagram [-tmuwh] [-g number] [-s screen] [filename.png]
-w : take only a window for the shot (choose with pointer)
-h : display this help
-d path : save the shot in <path>
- -g : create a gif (press 'q' to stop)
-s screen : use only the screen number <screen> for the shot
Also, do not give path to shot. They're saved to $SSHOT_DIR by default.
t@@ -40,11 +38,7 @@ Configuration:
SHBLAH
}
-function upload() {
- $EXEC_UPLOAD $1
-}
-
-function headshot() {
+headshot() {
xdpyinfo -ext XINERAMA | sed 's/^ head #//p' |
while IFS=' :x@,' read i w h x y; do
t@@ -54,27 +48,12 @@ function headshot() {
done
}
-function gifit() {
-
- test -z "$SCREEN" && SCREEN=0
- RES=`xdpyinfo -ext XINERAMA | sed -n "s/^ head #$SCREEN: \([0-9x]*\) .*$/\1/p"`
-
- mkdir $SSHOT_DIR/tmp/
-
- ffmpeg -f x11grab -s $RES -r 8 -i :0.$SCREEN $SSHOT_DIR/tmp/record.mkv
- ffmpeg -i $SSHOT_DIR/tmp/record.mkv -t 0:0:5 -f image2 $SSHOT_DIR/tmp/%03d.jpg
- convert -delay 10 $SSHOT_DIR/tmp/*.jpg -coalesce -layers OptimizeTransparency $1
-
- rm -rf $SSHOT_DIR/tmp/
-}
-
[[ "$1" = "--help" ]] && usage && exit 0
while getopts ":htmuwd:gs:" opt; do
case $opt in
t) THUMB=1 ;;
d) SSHOT_DIR=$OPTARG ;;
- g) GIF=1 ;;
s) SCREEN=$OPTARG ;;
u) UPLOAD=1 ;;
w) WINDOW=`xprop|grep 'window id'|cut -d\ -f7`;;
t@@ -85,15 +64,10 @@ done
shift $((OPTIND-1))
-
test -z $1 && OUTPUT=$WMNAME-`date +%Y-%m-%d`.png || OUTPUT=$1
test -z "$WINDOW" && WINDOW='root'
-if [ -n "$GIF" ]; then
- OUTPUT=${OUTPUT/.png/.gif}
- gifit $OUTPUT
-elif [ -n "$SCREEN" ]; then
- #OUTPUT=head_$SCREEN-$OUTPUT
+if [ -n "$SCREEN" ]; then
headshot $SCREEN
else
import -window ${WINDOW} $SSHOT_DIR/$OUTPUT
t@@ -102,9 +76,6 @@ fi
test -n "$THUMB" && import -window ${WINDOW} -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT}
-meh $SSHOT_DIR/$OUTPUT
+$VIEWER $SSHOT_DIR/$OUTPUT
-if [ "$UPLOAD" = "1" ]; then
- cd ${IMAGE_DIR}
- upload wm/${OUTPUT}
-fi
+test "$UPLOAD" = "1" && upload ${OUTPUT}