#!/bin/bash # # ---------------------------------------------------------------------- # # Description: This script can convert Digikam Keyword Tags to Bibble/AfterShot Pro XMP sidecar files # # Author: Maccus # # Initial version: 110712-01 # # Update: 120116-01 # # - Dave Clendenan fixed "Digikam_root_tag;ActualTagName" renaming bug. Thanx Dave! # # This script has been written and tested on # Ubuntu Linux 10.04 and Debian Testing (Wheezy) # # ---------------------------------------------------------------------- # # Usage: Place the script in "/usr/local/bin", do a # # "chmod +x /usr/local/bin/photo-d2b-xmp" as root. # # Then, copy the script TO THE ROOT OF YOUR IMAGE COLLECTION # # cp "/path/to/script/d2bxmp" "/path/to/collectionroot/photo-d2b-xmp" # # Change to the location of the script and run it: # # cd "/path/to/collectionroot/" && ./photo-db2-xmp # # ---------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ---------------------------------------------------------------------- # # Uncomment for debugging # # set -x # Start script echo -e "\n\033[1;33mSTATUS\033[0m: Script \"$(basename $0)\" started...\n" find "." -name "*.xmp" | sort -d -r | while read file ; do dir="$(dirname ${file})" file="$(basename ${file} .xmp)" if grep -q "digiKam" ${dir}/${file}.xmp; then #keywords="$(cat ${dir}/${file}.xmp | grep "|" | sed "s|.*||;s|||;s|\||;|g" | tr '\n' ',')" # Fix by Dave Clendenan keywords="$(cat ${dir}/${file}.xmp | grep "|" | sed "s|_Digikam_root_tag_\|||;s|.*||;s|||;s|\||;|g" | tr '\n' ',')" echo "Processing [${file}] - [${keywords}]" cat > ${dir}/${file}.tmp << EOF EOF mv ${dir}/${file}.tmp ${dir}/${file}.xmp unset keywords fi done echo "Done... Hit enter to quit..." read exit 0