From d332a99154945cfebadbf01b56f6033467e1c5ef Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Mon, 6 Feb 2023 19:50:14 -0500 Subject: init push Added: firejail - just scripts for firejail options l2w_snd - piping sound from linux to windows over the network misc_scripts - misc scripts.... proton_sieve - proton sieve file for mainbox sorting sys_ctrl - system control scripts --- misc_scipts/nef_update_from_xmp | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 misc_scipts/nef_update_from_xmp (limited to 'misc_scipts/nef_update_from_xmp') diff --git a/misc_scipts/nef_update_from_xmp b/misc_scipts/nef_update_from_xmp new file mode 100755 index 0000000..b897cf2 --- /dev/null +++ b/misc_scipts/nef_update_from_xmp @@ -0,0 +1,84 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2023 Brian Woods +# SPDX-License-Identifier: GPL-2.0-or-later + +# ------------------------------------------------------------------ +# an exiftool rating updater +# This tool reads in xmp files from darktable and updates the +# orginal NEF file with the xmp file's rating. This is so when +# exporting darktable pictures into lightroom, the rating is +# imported into lightroom +# ------------------------------------------------------------------ + +VERSION=0.1.0 +USAGE="Usage: `basename "$0"` -bh \n" +USAGE+="\t-b => backup orginals\n" +USAGE+="\t-r => remove xmp after updating\n" +USAGE+="\t-h => help" + + +BACKUP="-overwrite_original" +REMOVE=false + +if [ $# == 0 ] ; then + echo -e $USAGE + exit 1; +fi + +while getopts ":rbh" optname ; do + case "$optname" in + "v") + echo "Version $VERSION" + exit 0; + ;; + "b") + BACKUP= + ;; + "r") + REMOVE=true + ;; + "h") + echo -e $USAGE + exit 0; + ;; + "?") + echo "Unknown option $OPTARG" + exit 0; + ;; + ":") + echo "No argument value for option $OPTARG" + exit 0; + ;; + *) + echo "Unknown error while processing options" + exit 0; + ;; + esac +done + +shift $(($OPTIND - 1)) + +for NEFFILE in "$@" ; do + if [ ! -f ${NEFFILE} ] ; then + echo "${NEFFILE} doesn't exist, skipping" + continue; + fi + + XMPFILE="${NEFFILE}.xmp" + if [ ! -f ${XMPFILE} ] ; then + echo "${XMPFILE} doesn't exist, skipping" + continue; + fi + + exiftool ${BACKUP} -tagsFromFile ${XMPFILE} -Rating ${NEFFILE} + RV=$? + + if (($RV > 0)) ; then + echo "Updating rating from ${XMPFILE} to ${NEFFILE} failed" + continue + fi + + if [ "${REMOVE}" = true ] ; then + rm ${XMPFILE} + fi +done -- cgit v1.2.3