source: imagecap

Last change on this file was a4f1d53, checked in by Agnibho Mondal <mondal@…>, 2 years ago

Changed edit option

  • Property mode set to 100755
File size: 1.5 KB
Line 
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
24SELF="$(realpath "$0")";
25if [ "$VISUAL" ];then
26        EDIT="$VISUAL";
27elif [ "$EDITOR" ];then
28        EDIT="$EDITOR";
29else
30        EDIT="vi";
31fi
32ARG="$(echo $1 | sed "s/^file:\/\///g")";
33DIR="$(dirname "$ARG")";
34if [ -n "$ARG" ];then
35        IMG="$DIR/$(basename "$ARG")";
36fi
37
38function update(){
39        TEMP=$(mktemp);
40        exiftool -S -s -b -comment "$1">$TEMP;
41        ls -l $TEMP;
42        $EDIT $TEMP;
43        exiftool -overwrite_original_in_place "-comment<=$TEMP" "$1";
44        rm $TEMP;
45}
46
47function view(){
48        if [ -n "$IMG" ];then
49                feh -q --action1 ";$SELF -e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted --start-at "$IMG" "$DIR";
50        else
51                feh -q --action1 ";$SELF -e '%f'" --info "exiftool -S -s -b -comment '%f'" --scale-down --draw-tinted "$DIR";
52        fi
53}
54
55if [ "$1" == "-e" ];then
56        update "$2";
57else
58        view "$1";
59fi
Note: See TracBrowser for help on using the repository browser.