Ferramenta Shellscript com GUI
Eu modifiquei uma ferramenta de shellscript, que pode criar uma lista de imagens selecionadas selected.txt
. Você pode usar a tecla Enter para selecionar uma imagem ou a tecla Escape para ignorá-la.
Você também pode refazer a seleção anexando arquivos à lista e pular os arquivos restantes com a janela "Ignorar outras fotos".
Os seguintes arquivos são criados (no diretório atual)
names.txt # a list of all the files in the current directory tree
list.txt # a working list of selected files, that may contain duplicates
selected.txt # the final list of selected files
Você precisa do visualizador feh
para mostrar as imagens e xterm
para ajudar a obter a janela com a pergunta no topo (de acordo com testes no Kubuntu e no Lubuntu).
sudo apt install feh xterm
O shellscript é testado em
- Lubuntu e Ubuntu 16.04 LTS
- Ubuntu 17.10
- Kubuntu Bionic (18.04 LTS).
Aqui está o shellscript:
#!/bin/bash
# Copyright 2018 Nio Wiklund
#
# GPLv3: GNU GPL version 3
#
# This shellscript works with files in the current directory and its
# subdirectories. There is also an assumption that you
#
# batch resize the files to jpg and/or png files.
#
# This can be modified in the lines starting with 'find'
#
# You may need to select another 'sleep time' in order to
# get the question window on top of the picture window,
# if the files load slowly into the file viewer 'feh'.
#
########################################################################
marker () {
xterm -geometry 10x1 -e bash -c \
"zenity --title='Select this picture' --question --text='Select picture?' \
--width=240 2> /dev/null && echo $1 >> list.txt"
}
skipper () {
( zenity --title="Skip other pictures" --width=480 --height=240 \
--question --text="Are you sure that you want to skip all the other pictures?" \
2> /dev/null && > skip ) &
}
counter () {
cnt=$(wc -l "$1" | sed 's/ .*//')
echo "$cnt pictures are listed in '$1'"
}
########################################################################
# main
########################################################################
if test -e skip
then
rm skip
fi
if test -s selected.txt
then
zenity --title="Create a new list or append?" --question \
--width=360 --text="You can use the mouse, but maybe it is
easier to use the 'Enter' and 'Escape' keys
Append to previous selection?" 2> /dev/null
if [ "$?" == "0" ]
then
cp selected.txt list.txt
else
> list.txt
fi
fi
skipper
find -iname "*.jpg" | sort > names.txt
find -iname "*.png" | sort >> names.txt
counter names.txt
ifs0="$IFS"
while IFS='' read -r line || [[ -n "$line" ]]; do
if test -e skip
then
break
fi
feh -g 1024x1024 "$line" & pid=$!
sleep 0.5
marker "$line"
kill "$pid"
done < names.txt
IFS="$ifs0"
if test -s list.txt
then
sort -u list.txt | tr -s '\n' '\n' > selected.txt
counter selected.txt
else
echo "No picture selected"
fi
Screenshots
As seguintes capturas de tela foram criadas no Ubuntu 17.10 (com o Wayland).
feh-create-new-list-ou-append.png:
feh-select-picture.png:
feh-skip-other-pictures.png:
feh-terminal-output.png: