More > JRiver Media Center 25 for Mac

Batch replace tag conent

(1/7) > >>

HaWi:
I am doing some serious management of my classical music library to conform to my own naming convention throughout. Unfortunately, it seems every publisher uses a different nomenclature so almost everything needs to be changed. I searched around but couldn’t find anything.  What I’d like to do, for example, is to replace a specific part of a tag field
(say, ”K.  ###“) with something else (say, “KV###”).
Is that possible? And if yes, how would I go about it?
Many thanks for any help.
Hans

blgentry:
Let say you have done some kind of search and you know that you have 50 tracks that have this pattern in them.  But let's make this a silly example so I can illustrate some points.  Let's pretend that the field you are interested in has a value of: ORANGE .  You really want to change this value to APPLE.

Select all the tracks.
Open the Tag Window (Edit > Tag)
Find the field.
See that it says ORANGE.
Type in APPLE.

That changes them all.  You probably knew that.  Let's build on this example.

Now let's pretend that your field contains ORANGE 357... and ORANGE 12, and ORANGE 007... and more but it's always ORANGE and some numbers.  You want it to be APPLE and those same numbers.

Do all the same stuff, up to typing in the field. For this example, we are going to pretend that the name of the field is [Work] .  This time, in the field, insert this value:


--- Code: ---=Replace([Work],ORANGE,APPLE)
--- End code ---

The "=" tells MC "this is an expression; evaluate it".  Replace() is an expression language function.  See it's docs here:

https://wiki.jriver.com/index.php/String_Manipulation_Functions#Replace

You give it the original field to look in ([Work]), the string to look for (ORANGE), and the string to replace it with (APPLE).  It then operates on each song (file) individually, evaluating that expression and inserting the results in the field you typed it into (which is also [Work].

You are probably going to need to develop a more complicated expression.   You might have to use a Regular Expression to do so.  A simple Replace() might work too; it really depends upon exactly how the data is formatted and what it needs to be changed to.  "Regular Expressions" are a super powerful (but somewhat arcane) way of manipulating strings.  MC supports them through the expression language.

If you post a few examples of what you want to find and what you want to replace, we might be able to get you started with an expression (or two or three) that will get you started.

Good luck.

Brian.

HaWi:
Thank you so much Brian!
This is going to save me hundreds of hours. I’ll give it a go and might be back with some more specific questions but your answer already taught me a lot.
Cheers,
Hans

HaWi:
Hi Brian,
So I did successfully replace some stuff, eg I replaced "No. " with "#". However, when I wanted to replace "K. " with "KV" it appended the KV at the end of the tag. (see the two attached screen shots). I used this expression: =Replace ([Name],K. ,KV). What am I doing wrong?
Many thanks!
Hans
https://www.dropbox.com/s/ohec05javd759dp/Names.png?dl=0
https://www.dropbox.com/s/6vw3meljpdc0o3i/Names_Replaced.png?dl=0

EDIT: I figured it out, I had a <SPACE> between "Replace" and "(" .  I guess that tells you I'm no coder. Details matter!

BryanC:

--- Quote from: HaWi on October 24, 2019, 08:13:50 am ---Hi Brian,
So I did successfully replace some stuff, eg I replaced "No. " with "#". However, when I wanted to replace "K. " with "KV" it appended the KV at the end of the tag. (see the two attached screen shots). I used this expression: =Replace ([Name],K. ,KV). What am I doing wrong?
Many thanks!
Hans
https://www.dropbox.com/s/ohec05javd759dp/Names.png?dl=0
https://www.dropbox.com/s/6vw3meljpdc0o3i/Names_Replaced.png?dl=0

--- End quote ---

You've got an extra space in your expression.


--- Code: ---=Replace([Name],K. ,KV)
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version