Compare commits
2 Commits
cdd82136e0
...
e1c92664be
| Author | SHA1 | Date | |
|---|---|---|---|
| e1c92664be | |||
| d881964832 |
4
.vimrc
4
.vimrc
@ -43,8 +43,8 @@ set modelines=5 " Number of lines to check for vim: directives at the st
|
|||||||
set autoindent " AutomaticAlly indent new line
|
set autoindent " AutomaticAlly indent new line
|
||||||
|
|
||||||
" Indentation
|
" Indentation
|
||||||
set ts=4 " Number of spaces in a tab
|
set ts=2 " Number of spaces in a tab
|
||||||
set sw=4 " Number of spaces for indent
|
set sw=2 " Number of spaces for indent
|
||||||
set et " Expand tabs into spaces
|
set et " Expand tabs into spaces
|
||||||
|
|
||||||
" Mouse settings
|
" Mouse settings
|
||||||
|
|||||||
38
bin/dt-import-geeqie-ratings
Executable file
38
bin/dt-import-geeqie-ratings
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e -u
|
||||||
|
|
||||||
|
SCRIPTNAME=`basename "${0}"`
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Import (and overwrite!) Geeqie ratings to Darktable"
|
||||||
|
echo "Usage: ${SCRIPTNAME} DIRECTORY"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "${#}" -ne 1 ] || [ ! -d "${1}" ] ; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Don't touch XMP files while Darktable is running
|
||||||
|
[ "`pidof darktable`" ] && { echo "Error: Darktable is running, aborting." ; false ; }
|
||||||
|
|
||||||
|
DARKTABLE_DIR=`realpath "${1}"`
|
||||||
|
GEEQIE_DIR=`realpath "${HOME}/.local/share/geeqie/metadata${DARKTABLE_DIR}"`
|
||||||
|
RATING_FIELD="xmp:Rating"
|
||||||
|
|
||||||
|
count=0
|
||||||
|
for dt_xmp in `find "${DARKTABLE_DIR}" -maxdepth 1 -type f -name '*.xmp'` ; do
|
||||||
|
img=`echo "\`basename ${dt_xmp}\`" | sed 's/\.xmp$//'`
|
||||||
|
gq_xmp="${GEEQIE_DIR}/${img}.gq.xmp"
|
||||||
|
if [ -r "${dt_xmp}" ] && [ -r "${gq_xmp}" ] ; then
|
||||||
|
gq_rating=`grep "${RATING_FIELD}" "$gq_xmp" | cut -d'"' -f2`
|
||||||
|
dt_rating=`grep "${RATING_FIELD}" "$dt_xmp" | cut -d'"' -f2`
|
||||||
|
if [ "${gq_rating}" ] && [ "${dt_rating}" ] && [ ${gq_rating} -ne ${dt_rating} ] ; then
|
||||||
|
((++count)) # Pre-increment because post-increment fails with 'set -e' :)
|
||||||
|
echo "counted"
|
||||||
|
sed -i 's/'${RATING_FIELD}'="'${dt_rating}'"/'${RATING_FIELD}'="'${gq_rating}'"/' "${dt_xmp}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${count} ratings imported. Remember to activate sidecar scanning at Darktable start-up."
|
||||||
Loading…
Reference in New Issue
Block a user