INTERACT FORUM

Please login or register.

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

Author Topic: Help needed please: Copy value of custom tag from audio library to image library  (Read 693 times)

markf2748

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 814

My audio files have an embedded custom tag called TAGGINGTIME with a date in it, which is the same for every audio file in the album.  I manually fill in this date whenever I rip a CD, and then it remains unchanged.

I have image files, typically *.jpg, stored along side in same music sub-directory.
These were imported into a JRiver Imaging View which shows the image files have the same custom tag field, but it is empty.

How do I copy the audio tag value into the same-named image library tag?  I require a semi-automated method since I want to do this for my entire music collection (manual copy / paste of tags works, but it is too laborious for the entire collection).

I tried simple things with my limited knowledge of MC's Expression Language, but could not solve it.

Thanks for any ideas.



Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591

The FieldQuery() function can be used for that (undocumented, but explained here). It finds files that share some tag value and then returns the value of another tag of that file. In your case, we can use it to get the [TAGGINGTIME] of an Audio file sharing the same [Filename (path)].

I just tested it and hit an issue - the function doesn't allow to limit the search to only Audio files, so it may find the Image file itself, which will have an empty TAGGINGTIME. However, there's a workaround.

You can try the direct function first - it will probably work for most of your files, but perhaps not all:
- Use this expression on the [TAGGINGTIME] field of the Images you need to tag:
    =listitem(fieldquery(Filename /(path/), [Filename (path)], TAGGINGTIME, 1, 0), 0)

If that doesn't work you need to do this:
- create a new Field called "Type:Folder", Calculated, with expression="[Media Type]:[Filename (path)]"
- use this expression for the [TAGGINGTIME] of the images:
    =listitem(fieldquery(Type:Folder, Audio:[Filename (path)], TAGGINGTIME, 1, 0), 0)

if you get a number instead of a Date, you'll need to add a FormatDate:
    =FormatDate(listitem(fieldquery(Type:Folder, Audio:[Filename (path)], TAGGINGTIME, 1, 0), 0), date)
Logged

markf2748

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 814

The FieldQuery() function can be used for that (undocumented, but explained here). It finds files that share some tag value and then returns the value of another tag of that file. In your case, we can use it to get the [TAGGINGTIME] of an Audio file sharing the same [Filename (path)].

Fantastic, very very cool.  It took a while to wrap my head around this, but then it worked great. I copied nearly 2000 tag values between libraries in well under a minute, thank you (especially for explicit examples) :)

Note:  I find that if I apply FieldQuery() to tags that are not writable, then it silently fails.  Would be nice if MC raised an informative error message in this case, but I guess that is not the MC way (time constraints) ;)

In a related matter, all my Audio views do a terrific job of automatically keeping up with background file changes.  However my Image views do not.  Consequently my Image views often need manual upkeep.  Is it generally acknowledged that the Image type Library is less capable of detecting file changes, or am I missing something in its setup?

Logged
Pages: [1]   Go Up