INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Question on using Tag(..) function  (Read 3434 times)

Cmagic

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1196
  • Enjoying life with a little music....
Question on using Tag(..) function
« on: April 11, 2008, 04:08:21 pm »

Hi,

The MC wiki for expression language describes a function that reads directly the physical tags (exif, iptc, xmp, mmjd) from an image file: Tag(field)

Reading the wiki I thought this would let me read any tags (such as iptc: Headline, iptc: ObjectName or xmp: PreservedFileName). Despite all my efforts in trying this to work, I failed to read any physical tag  :(
The only tag I was able to read is Date (exif: Date, iptc: Date, xmp: Date) as in the example from the wiki.

Therefore I assume that the Tag() function is really designed to work only with Date as documented in the wiki. Could someone confirm or infirm this ?

In case I missed something what is the exact syntax to actually read for example the iptc: ObjectName tag ?

I tried Tag(iptc: ObjectName), Tag(IPTC: ObjectName) an several other variations without success.

Thanks for any help on that,

Christian
Logged
Until the color of a man's skin is of no more significance
than the color of his eyes.
Bob Marley (War)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Question on using Tag(..) function
« Reply #1 on: April 12, 2008, 03:19:11 am »

Morning Christian,

I did a little digging, and here are my conclusions:

tag() was introduced primarily to deal with situations where there is differing data in different tag blocks and it allows us to override MC's default order of importing data from the various tag blocks contained within a .jpg file; different dates being the classic example. When the function was first introduced, I had trouble getting it to work and Matt offered the following explanation:
Quote
Quote
I cannot get this to work with anything other than MJMD tags. I've tried as many combinations as I can think of, including capitalisations and spaces:

tag(exif: date)
tag([exif: date])
tag(exif: [date])
tag(exif: date taken)
tag(exif: date/time)

If I try them in the [date] field of the tag window, "Unknown Date" is returned and the file's date is changed to 0000/01/01 (used with a leading = sign)
If I try them in a standard field, the field is left unchanged.
If I try them as thumbnail text, (3rd line), the entire thumbnail text is shown as "Expression Error (Unknown)"
-marko
Capitalization is ignored for the prefix and function, but you need correct capitalization for the field, so use "Date".  Here are complete examples that will work:

=Tag(Exif: Date)
=tag(exif: Date)
=tAG(EXIF: Date)

Note that "Date" must be correctly cased.  This is because you're talking directly to an input / tagging plugin.  It compares what you pass it against a defined list of fields.  There's never been a need to consider case here since previously only the program itself called into these, where the case would always be consistent.
I didn't pick up on it at the time, but I think the key here is the "defined list of fields" part that I've bolded above.

The following quote details the current iptc > MC mappings:

As was mentioned elsewhere, this is very early in development. All these comments are very welcome and helpful as we develop this further. In addition to reading IPTC, we are looking into reading other TAG formats--is everyone using IPTC these days, or do people use competing or superseeding standards? We are also planning to implement writing out the tags.

The way the IPTC tags are read currently, as I understand it, is any matched field that is not aready being used is read from IPTC. This means once read, the IPTC tags won't be read again from that photo, unless the tags are cleared in MC. The IPTC and existing tags are not merged. Any of this, of course is subject to change.

Here are the current IPTC tags being read, and MC tags the are mapped to (also subject to change):

BYLINE -> Artist
CREDITS -> Notes
DATECREATED ->[changed] Date
CITY STATE, COUNTRY ->(combined) Places
COPYRIGHTNOTICE ->Copyright
CAPTION ->(same: no longer Comment)
CATEGORY->Genre
KEYWORDS->(same)

Suggestions to mapping as well as all other suggestions, are welcome.

JimN
And in my quick tests, the only data I could get MC to import using tag() was the stuff that is in that field mapping list. Nothing else would import.
Someone from JRiver will need to confirm whether or not my theory is sound, but as far as I can see, you are using the correct syntax, and I am getting the same results as you are.
Sorry I can't be more helpful than that at this time,

-marko.

Cmagic

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1196
  • Enjoying life with a little music....
Re: Question on using Tag(..) function
« Reply #2 on: April 12, 2008, 04:23:33 am »

Marko,

Thanks for the insights and links to relevant threads.
My mistake was in believing I could use the standard xmp or iptc tag names within Tag() when in reality it only accepts MC fields that are internally mapped to image tags.
Therefore the current implementation of the Tag() function cannot retrieve images tags that are not internally mapped to MC fields.
Except the case of Date where Tag() can be used to force a read form the exif, iptc or xmp Dates, the current implementation of Tag() is not that useful.

I'm heading for a busy "in the garden" week-end, hope the weather will behave like it should do in spring !
Again thanks Marko.

Christian

Logged
Until the color of a man's skin is of no more significance
than the color of his eyes.
Bob Marley (War)

ShayB

  • Junior Woodchuck
  • **
  • Posts: 97
Re: Question on using Tag(..) function
« Reply #3 on: October 15, 2008, 05:27:22 pm »

Hi,
Actually, I am looking at the wiki page and see that:
"Tag(...): Reads in the physical file tag rather than looking in the database" regardless of the type of media..

Is it a mistake on the page?

if it is not, can I use =tag([name]) for audio files?

Shay
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42385
  • Shoes gone again!
Re: Question on using Tag(..) function
« Reply #4 on: October 15, 2008, 05:30:22 pm »

can I use =tag([name]) for audio files?

Yes.  Remember that the field names are case-sensitive.
Logged
Matt Ashland, JRiver Media Center

ShayB

  • Junior Woodchuck
  • **
  • Posts: 97
Re: Question on using Tag(..) function
« Reply #5 on: October 15, 2008, 06:08:24 pm »

..
I am doing something wrong then...

1. I defined a field name "_name_from_tag" and set its calculated value to =Tag([Name])
2. I placed the field on some audio view scheme.

The disc is doing some work but afterward I don't see values in this field...

can you help?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42385
  • Shoes gone again!
Re: Question on using Tag(..) function
« Reply #6 on: October 15, 2008, 07:05:27 pm »

..
I am doing something wrong then...

1. I defined a field name "_name_from_tag" and set its calculated value to =Tag([Name])
2. I placed the field on some audio view scheme.

The disc is doing some work but afterward I don't see values in this field...

can you help?

Hopefully if you use:
Tag(Name)

Instead of:
Tag([Name])

everything will work.

"Tag([Name])" translates to "Tag(Field(Name))" which I don't think is what you're hoping for.
Logged
Matt Ashland, JRiver Media Center

ShayB

  • Junior Woodchuck
  • **
  • Posts: 97
Re: Question on using Tag(..) function
« Reply #7 on: October 15, 2008, 07:14:32 pm »

Hopefully if you use:
Tag(Name)

Instead of:
Tag([Name])

everything will work.

"Tag([Name])" translates to "Tag(Field(Name))" which I don't think is what you're hoping for.

Indeed it worked  :)

thanks Matt
Logged

ShayB

  • Junior Woodchuck
  • **
  • Posts: 97
Re: Question on using Tag(..) function
« Reply #8 on: October 15, 2008, 07:24:29 pm »

Matt,

I am writing a view scheme that should compare several fields (Tags VS. library tags)
what is the efficient way to do this (I mean, the view scheme will only read each file once)?

Shay
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42385
  • Shoes gone again!
Re: Question on using Tag(..) function
« Reply #9 on: October 15, 2008, 08:07:41 pm »

We recommend using slow expression functions like Tag(...) or IsMissing(...) that must access the disk sparingly.  Using them in a view scheme you use often can dramatically hurt performance.

So although we try to evaluate expressions as seldom and efficiently as possible, the only way to ensure an expression won't get evaluated over and over is to evaluate it once and store it statically in a field.
Logged
Matt Ashland, JRiver Media Center

ShayB

  • Junior Woodchuck
  • **
  • Posts: 97
Re: Question on using Tag(..) function
« Reply #10 on: October 15, 2008, 08:49:03 pm »

We recommend using slow expression functions like Tag(...) or IsMissing(...) that must access the disk sparingly.  Using them in a view scheme you use often can dramatically hurt performance.

So although we try to evaluate expressions as seldom and efficiently as possible, the only way to ensure an expression won't get evaluated over and over is to evaluate it once and store it statically in a field.

I defined a field "_calc_tags" which has the calculated vales Tag(Name);Tag(Artist)
I then compare this field with the string [Name];[Artist]
on a database of ~16,000 entries it takes several minutes ( I always just kill the process)
no metter which method I used (view scheme / smart playlist / as a {0,1} value for each entry)
:-(
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42385
  • Shoes gone again!
Re: Question on using Tag(..) function
« Reply #11 on: October 15, 2008, 10:13:09 pm »

I defined a field "_calc_tags" which has the calculated vales Tag(Name);Tag(Artist)
I then compare this field with the string [Name];[Artist]
on a database of ~16,000 entries it takes several minutes ( I always just kill the process)

Create a non-calculated field.  Fill it in doing an in-place edit:
=Tag(Name);Tag(Artist)

This way, it will be evaluated once and stored.  Work in batches of 100 or 1000 files.

Note that the view would also work if you waited longer.  Reading 32,000 tag values will take quite a while.
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up