INTERACT FORUM

Please login or register.

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

Author Topic: Classical music tagging cleanup - Help needed with expression  (Read 1983 times)

jacobacci

  • Galactic Citizen
  • ****
  • Posts: 256
Classical music tagging cleanup - Help needed with expression
« on: October 31, 2015, 05:14:54 am »

After reading some of the threads regarding tagging of classical music, I will bite the bullet an change my tagging scheme

So far I have used:
Artist: Beethoven
Album: Abbado - Symphony Nr 1 (the conductor and the piece are always separated by a hyphen)
Title: Movement 1,2,3 etc.

In the meantime the number of multi composer (but single artist) compilations in my collection has grown to such an extent, that I would like to move to
Artist: Abbado
Album. Beethoven - Symphony Nr 1
Title: Movement 1,2,3 etc
Composer: Beethoven

I have successfully copied the artist field to the composer field.

Now I would like to
- extract 'Abbado' from the Album tag and place it in the conductor tag
- extract 'Symphony Nr 1' from the Album tag and place it in the notes tag

In a following step I would like to copy the stored tags back to the new target tag fields using move/copy fields.

How would I best do the extraction of the two components of the album tag and copy them to their interim storage tag?

Logged

jacobacci

  • Galactic Citizen
  • ****
  • Posts: 256
Re: Classical music tagging cleanup - Help needed with expression
« Reply #1 on: October 31, 2015, 08:07:28 am »

ok, made some progress.
I figured out that
=listitem([Name],0,-) will give me what precedes the hyphen (replace 0 by 1 to get the stuff after the FIRST hyphen)

Where I stumble is when there are several hyphens in the Name e.g.
"D_Savall, Jordi - Les Quatre Ouvertures - Suites pour Orchestre, BWV 1066-69 (1) (AliaVox SACD)"
In this case the expression will only extract "Les Quatre Ouvertures" and ignore what follows.

Ideally in the above example I would like to extract:
Savall, Jordi (without the D_ at the beginning, although that could easily be removed afterwards)
Les Quatre Ouvertures - Suites pour Orchestre, BWV 1066-69 (1) (AliaVox SACD)



Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Classical music tagging cleanup - Help needed with expression
« Reply #2 on: October 31, 2015, 08:21:49 am »

He flies in with a giant R on his cape.  Here he is to save the day!  It's Regex to the rescue!

I believe our superhero would recommend the following 2 expressions to extract your values:

Code: [Select]
regex([Album],/#([^-]+)\s*-\s*(.+)$#/,1,0)
Code: [Select]
regex([Album],/#([^-]+)\s*-\s*(.+)$#/,2,0)
Notice that they are identical, except for the 3rd argument, which tells Regex to select either the first back reference, or the 2nd back reference.

Let me know if those work or not, and I'll summon our hero again if necessary.  :P

Brian.
Logged

jacobacci

  • Galactic Citizen
  • ****
  • Posts: 256
Re: Classical music tagging cleanup - Help needed with expression
« Reply #3 on: October 31, 2015, 08:42:25 am »

Brian to the rescue:
Actually I just stumbled across your regex tutorial https://yabb.jriver.com/interact/index.php?topic=97996.0 and came up with an expression of my own that ACTUALLY WORKS. Thanks for that great tutorial.
My expression: regex([Album],/#( - )(.+)#/, 2, 0)
Yours is much more sophisticated in ways I could not even begin to fathom. What does the extra stuff mean?


Logged
Pages: [1]   Go Up