]> Softwares of Agnibho - imagecap.git/blob - imagecap
a5a8f1231ef63d63907b85a0b902a9e99e88c00d
[imagecap.git] / imagecap
1 #! /bin/bash
2
3 # Copyright (c) 2017 Agnibho Mondal
4 # All rights reserved
5 #
6 # This file is part of ImageCap.
7 #
8 # ImageCap is free software: you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation, either version 3 of the License, or (at your option) any later
11 # version.
12 #
13 # ImageCap is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 # PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # ImageCap. If not, see <http://www.gnu.org/licenses/>.
19 #
20 # Agnibho Mondal
21 # contact@agnibho.com
22 # www.agnibho.com
23
24 SELF="$(realpath "$0")";
25 ARG="$(echo $1 | sed "s/^file:\/\///g")";
26 DIR="$(dirname "$ARG")";
27 if [ -n "$ARG" ];then
28 IMG="$DIR/$(basename "$ARG")";
29 fi
30
31 function update(){
32 TEMP=$(mktemp);
33 exiftool -S -s -b -comment "$1">$TEMP;
34 ls -l $TEMP;
35 xdg-open $TEMP;
36 exiftool -overwrite_original_in_place "-comment<=$TEMP" "$1";
37 rm $TEMP;
38 }
39
40 function view(){
41 if [ -n "$IMG" ];then
42 feh -q --action1 ";$SELF -e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted --start-at "$IMG" "$DIR";
43 else
44 feh -q --action1 ";$SELF -e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted "$DIR";
45 fi
46 }
47
48 if [ "$1" == "-e" ];then
49 update "$2";
50 else
51 view "$1";
52 fi