YAD with Exiftool and Multiple Keywords

Started by rodertroy, July 31, 2015, 08:52:16 AM

Previous topic - Next topic

rodertroy

Hi,

I have a YAD (Yet Another Dialog) bash script that I use with Thunar Custom Actions in Linux Mint to write information to images with Exiftool. This is the form box:



This is the code:

#!/bin/bash

exiftoolform=$(yad --title "ExifTool" --form --field="Artist:" --field="Copyright:" --field="Headline:" --field="Description:" --field="Keywords:")

OldIFS="$IFS"; IFS='|' # Save the old IFS value to OldIFS and give the new value to IFS.
read ARTIST COPYRIGHT HEADLINE DESCRIPTION KEYWORDS <<< "$exiftoolform"
IFS="$OldIFS" # Give IFS back its original value.

exiftool -artist="$ARTIST" -copyright="$COPYRIGHT" -headline="$HEADLINE" -description="$DESCRIPTION" -keywords="$KEYWORDS" *.jpg


My problem is that when I add multiple keywords to the keywords box all the words are tied together as one keyword. I've tried separating the words in the following ways and nothing works:

+potato+latke+food+vendor
potato,latke,food,vendor
potato, latke, food, vendor
"potato,latke,food,vendor"
"potato, latke, food, vendor"
potato-latke-food-vendor
"potato""latke""food""vendor"

Any help would be appreciated.

Phil Harvey

I think that reading FAQ 17 will help here.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

rodertroy

Hi, I read that FAQ yesterday and tried using the "-IPTC:Keywords="  tag instead of the "-keywords=" tag. I also tried the -sep option to split values of list-type tags into separate items when writing. The keywords would still get clumped together as one.

Phil Harvey

Quote from: rodertroy on July 31, 2015, 09:12:32 AM
Hi, I read that FAQ yesterday and tried using the "-IPTC:Keywords="  tag instead of the "-keywords=" tag.

Either will have the same effect.

QuoteI also tried the -sep option to split values of list-type tags into separate items when writing. The keywords would still get clumped together as one.

If the separator used is the same as the one specified by the -sep option, then they will get split properly.  I can't explain why you say this doesn't work.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

rodertroy

This is the modified bash script:

#!/bin/bash

exiftoolform=$(yad --title "ExifTool" --form --field="Artist:" --field="Copyright:" --field="Headline:" --field="Description:" --field="Keywords:")

OldIFS="$IFS"; IFS='|' # Save the old IFS value to OldIFS and give the new value to IFS.
read ARTIST COPYRIGHT HEADLINE DESCRIPTION KEYWORDS <<< "$exiftoolform"
IFS="$OldIFS" # Give IFS back its original value.

exiftool -sep ", " -artist="$ARTIST" -copyright="$COPYRIGHT" -headline="$HEADLINE" -description="$DESCRIPTION" -keywords="$KEYWORDS" *.jpg


And in the keywords form box I type:

"potato, latke, food, vendor"

When I upload the image to Flickr it lists all four keywords as one keyword. It's probably an issue with YAD.

Phil Harvey

What is the output of this command on the image you uploaded?

exiftool -keywords -sep x FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

rodertroy

exiftool -keywords -sep x 20150706_042354.jpg

Keywords                        : "sausagexmcdonaldxegg"

Phil Harvey

So they are stored correctly as separate keywords.  The problem is elsewhere (Flickr?).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

rodertroy

Yes, it appears to be a problem with Flickr after all: https://www.flickr.com/help/forum/30000/?search=iptc

So it looks like I'll just have to create separate keyword fields in the form for multiple keywords instead of typing them all into the same field.

Thanks for your help!

Phil Harvey

I think you're confused.  They are already stored separately as I said.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

rodertroy

Yes, but according to the thread I linked to Fllckr handles separators between keywords (like commas) by jumbling them all together as one keyword.

rodertroy

I modified the script to two keyword fields and uploaded the image to Flickr. It now works. Flickr shows two keywords and doesn't jumble them together. It's just a shame I can't get it to work using one field for multiple keywords.

#!/bin/bash

exiftoolform=$(yad --title "ExifTool" --form --field="Artist:" --field="Copyright:" --field="Headline:" --field="Description:" --field="Keywords One:" --field="Keywords Two:")

OldIFS="$IFS"; IFS='|' # Save the old IFS value to OldIFS and give the new value to IFS.
read ARTIST COPYRIGHT HEADLINE DESCRIPTION KEYWORDSONE KEYWORDSTWO <<< "$exiftoolform"
IFS="$OldIFS" # Give IFS back its original value.

exiftool -sep ", " -artist="$ARTIST" -copyright="$COPYRIGHT" -headline="$HEADLINE" -description="$DESCRIPTION" -keywords="$KEYWORDSONE" -keywords="$KEYWORDSTWO" *.jpg




rodertroy

I was just looking at my Flickr page for the image I uploaded and in the exif data only one keyword is listed, though both keywords are listed as tags at the very bottom of the page, below the exif data. I then checked the uploaded image with the command you gave me:

exiftool -keywords -sep x 20150706_042354.jpg

I pressed enter and there's no output. It just created another command prompt. So that's kind of strange. And so I opened up the uploaded image in XNViewMP to look at the metadata and the keywords aren't listed, yet one of them is listed in the exif data on the Flickr page. So somehow I can't see the keywords in the metadata but Flickr sees one of them, and sees both of them to the extent that both appear as Flickr tags.

Phil Harvey

Quote from: rodertroy on July 31, 2015, 11:38:17 AM
Yes, but according to the thread I linked to Fllckr handles separators between keywords (like commas) by jumbling them all together as one keyword.

You misunderstand.  In your image, there were no separators.  The keywords were stored separately.  No commas, no nothing.  Effectively stored as separate tags.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Quote from: rodertroy on July 31, 2015, 12:08:53 PM
exiftool -keywords -sep x 20150706_042354.jpg

I pressed enter and there's no output.

You need to get your facts straight.  Check the XMP:Subject maybe.

My guess is that you are fooling yourself by looking at the wrong metadata.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).