Last active
September 7, 2015 15:59
-
-
Save lisotton/d89ada82c9781b092187 to your computer and use it in GitHub Desktop.
Create relationship between pictures and runner number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
CSV="identificador.csv" | |
FILES=$(ls *.jpg) | |
TITLE="Identificador de fotos..."; echo -en "\033]0;$TITLE\a" | |
CSV_IDENTIFIERS=$(awk -F "\"*,\"*" '{print $1}' $CSV) | |
NON_IDENTIFIED=$(echo "$CSV_IDENTIFIERS\n$FILES" | sort | uniq -u) | |
set -f; IFS=$'\n' | |
NON_IDENTIFIED_ARRAY=($(echo $NON_IDENTIFIED)) | |
set +f; unset IFS | |
for FILE in "${NON_IDENTIFIED_ARRAY[@]}"; do | |
eog -w -- "$FILE" > /dev/null 2>&1 & | |
PID=$! | |
(sleep 0.2s; wmctrl -a $TITLE) > /dev/null 2>&1 & | |
(sleep 0.4s; wmctrl -a $TITLE) > /dev/null 2>&1 & | |
(sleep 0.6s; wmctrl -a $TITLE) > /dev/null 2>&1 & | |
(sleep 0.8s; wmctrl -a $TITLE) > /dev/null 2>&1 & | |
(sleep 1.0s; wmctrl -a $TITLE) > /dev/null 2>&1 & | |
echo "Digite os identificadores:" | |
read IDENTIFIERS | |
if [[ "$IDENTIFIERS" == "x" ]]; then | |
rm -rf "$FILE" | |
continue | |
fi | |
if [[ "$IDENTIFIERS" == "" ]]; then | |
IDENTIFIERS=$PREVIOUS; | |
fi | |
IDENTIFIERS=$(echo "$IDENTIFIERS" | sed -e "s/\./ni/g") | |
PREVIOUS=$IDENTIFIERS | |
FILE_NAME=$(basename "$FILE") | |
echo "$FILE_NAME,$IDENTIFIERS" >> $CSV | |
#kill $PID | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment