Batch copy Description to Keywords with stop words

Started by Rusam, November 13, 2020, 11:21:17 AM

Previous topic - Next topic

StarGeek

From the docs on the -csv option
   Special feature: -csv+=CSVFILE may be used to add items to existing lists. This affects only list-type tags
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Rusam

#16
Quote from: StarGeek on November 13, 2020, 04:41:19 PM
From the docs on the -csv option
   Special feature: -csv+=CSVFILE may be used to add items to existing lists. This affects only list-type tags

Alas, it doesn't work. Neither does -j work.
Anyway, existing keywords tags are removed and inserted from the csv instead.

StarGeek

Does you CSV file have Keywords or Subject?  See my previous note about mixing groups.

It works here
C:\>type test.csv
Sourcefile,Subject
y:\!temp\Test4.jpg,"CSV Test1,CSV Test2"

C:\>exiftool -g1 -a -s -Subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Original 1, Original 2, Original 3

C:\>exiftool -P -overwrite_original -sep , -csv+=test.csv y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -Subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Original 1, Original 2, Original 3, CSV Test1, CSV Test2
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Rusam

I wrote my code above - it's three lines.

The first two lines add keywords from the Description.

Yes, keywords appear.

But when the third line works (with -csv + =), the keywords from the Description disappear and instead of them keywords from csv appear.

Rusam

Excuse me, please. I think I begin to understand. I need not Subject, and Keywords. Now I try to change.

Rusam

#20
I redid the commands and everything works!


I thank you so much!

StarGeek

Try
"-Subject<$Description,$Subject"

Though if you're worrying about the order the keywords are in, you might be better off re-thinking things and seeing if there's another tag that would work better.  Any program that deals with keywords doesn't care about the order (some will re-order the keywords anyway) and you'll be ending doing a lot more work than is really needed.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Rusam

#22
Thank you, StarGeek.
I read the forum. There is a lot of delight here!
I discovered NoDups - it's a fairy tale!
I discovered $_= lc
But this does not work at all -api 'Filter=tr/[A-Z]/[a-z]/. But it is not important.
But I so couldn't beat the doubling of commas. keyword1, keyword2, , keyword3, keyword4, keyword5, keyword6
If I specify deletion, then nothing happens. "-Subject<${Subject;s/, ,// g; s / + / / g}"
If I write one comma, it removes all commas in Subject. "-Subject <$ {Subject; s /, // g; s / + / / g}"
I have not found a command on the forum to replace two commas with one comma - that would be great!

I read https://exiftool.org/forum/index.php?topic=8495.0 and https://exiftool.org/forum/index.php?topic=8265.0 - It did not help.

StarGeek

#23
Quote from: Rusam on January 02, 2021, 05:15:52 PM
But this does not work at all -api 'Filter=tr/[A-Z]/[a-z]/.

The tr operator doesn't take regex, just a character range. That's a mistake I keep making. So 'Filter=tr/A-Z/a-z/' would work.  But lc() is a better option.

QuoteBut I so couldn't beat the doubling of commas. keyword1, keyword2, , keyword3, keyword4, keyword5, keyword6

Remember, the commas are separators.  They're don't actually exist in the tag unless you put them in a keyword.  You most likely have an empty or spaces only entry.  Try changing the separator with the -sep option to see where the separations are.  Something like -sep '##'

Try
exiftool -Subject-= /path/to/files/
to remove empty 0-length keywords.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype


Rusam

Greetings, dear developers!

Can the program cope with such a problem?

There are files with different number of keywords. So, me only need 10 keywords. That is, me need to remove all the keywords at the end of the keyword list so that only the first ten words remain.

StarGeek

Based upon this previous post, try
exiftool -sep ### "-Subject<${Subject;my @a=split /###/,$val;my @b=splice(@a,0,10);$_=join '###',@b}" /path/to/files/
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Rusam

Thank you, StarGeek!
You are together with Phil Harvey - Great Masters! And exiftool is a magical, which can a lot!