]> Softwares of Agnibho - imagecap.git/blob - imagecap
Initialized Repo
[imagecap.git] / imagecap
1 #! /bin/bash
2
3 #=========================================================
4 # Wrapper script for feh image viewer with comment support
5 #=========================================================
6
7 SELF="$(realpath "$0")";
8 EDIT="gvim -f";
9 ARG="$(echo $1 | sed "s/^file:\/\///g")";
10 DIR="$(dirname "$ARG")";
11 if [ -n "$ARG" ];then
12 #IMG="$(feh -U "$DIR"|grep "$ARG$")";
13 IMG="$DIR/$(basename "$ARG")";
14 fi
15
16 function update(){
17 TEMP=$(mktemp);
18 exiftool -S -s -b -comment "$1">$TEMP;
19 ls -l $TEMP;
20 $EDIT $TEMP;
21 exiftool -overwrite_original_in_place "-comment<=$TEMP" "$1";
22 rm $TEMP;
23 }
24
25 function view(){
26 if [ -n "$IMG" ];then
27 feh -q --action1 ";$SELF e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted --start-at "$IMG" "$DIR";
28 else
29 feh -q --action1 ";$SELF e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted "$DIR";
30 fi
31 }
32
33 if [ "$1" == "e" ];then
34 update "$2";
35 else
36 view "$1";
37 fi