combined string for Shortcut tags

Started by StarGeek, May 12, 2017, 12:13:12 PM

Previous topic - Next topic

StarGeek

From previous thread

Quote from: Phil Harvey on May 04, 2017, 11:37:25 AM
OK, thanks.  If you don't care one way or the other, I think I prefer the expression operating on the combined string for Shortcut tags (especially since these are combined using the -sep setting as of version 10.51), so I will do this for the next release.

Unfortunately, I didn't fully think through the implications of what you said here.  Since a few of my shortcuts contain 20+ tags, the end result is... let's just say messy.  I use these big shortcuts to do some simple batch edits (trimming leading/trailing whitespaces, fixing some capitalization errors, etc)

I'm really sorry for not paying enough attention, but is there any way for at least add an option to process shortcuts the old way?
"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

Phil Harvey

I hope this doesn't break things for too many people.  Would it be too inconvenient for you to do something like this to trim whitespace from each tag?:

${TAG;$_ = join ', ', map { s/^\s+// } @vals}

I admit this is a big ugly.  @vals is so far undocumented, but I could easily add it to the documentation. (Also, I would need to be sure it is filled if there is only one value, which currently isn't the case.  And I should probably change the name to @val to make the public interface more consistent.)

I did consider adding a new syntax like this to act on each value individually, but dropped the idea because writing understandable documentation could be a challenge:

${TAG@;s/^\s+//}

However, neither alternative maintains backward compatibility.  So if too many people are affected by this change then we need another idea.

- 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 ($).

Phil Harvey

And I have another question:

Do you use the -f option with this feature?  If so, would you prefer individual undefined tags of the shortcut to be set to "-", or just one "-" if no tags exist?

eg) Should exiftool -f -p "$myshortcut" produce "-, -" or "-" if MyShortcut is a shortcut for two tags that don't exist?

(If I did something like the "@" feature mentioned above, then I could do something like returning "-, -" with the "@", or "-" without.  But we're getting into subtleties here that would confuse most people.)

- 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 ($).

StarGeek

Actually, upon further inspection, I realized that my shortcut tags are using -api "filter=" which isn't affected. 

Sorry for the false alarm.
"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

Phil Harvey

OK, great.  (I guess -- I was hoping this may lead to adding a new cool feature.)

- 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 ($).