Skip to content

Instantly share code, notes, and snippets.

@erjiang
Created May 15, 2019 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erjiang/217943ae7b3f30b1b8e5f3ea252c1d38 to your computer and use it in GitHub Desktop.
Save erjiang/217943ae7b3f30b1b8e5f3ea252c1d38 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Given image files, check the file to see if it has an embedded rating. If it
# does, write it to a RawTherapee sidecar file (.pp3), unless there already is
# a sidecar file.
for FILE in $*
do
RATING=`exiftool -p '$Rating' $FILE`
if [ "$RATING" -ne "0" -a ! -z "$RATING" ]
then
if [ ! -f "$FILE.pp3" ]
then
echo Writing $RATING to $FILE.pp3
printf "[General]\nRank=$RATING\n" > "$FILE.pp3"
else
echo Skipping: $FILE.pp3 already exists
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment