INTERACT FORUM

Please login or register.

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

Author Topic: Batch replace tag conent  (Read 2695 times)

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Batch replace tag conent
« on: October 23, 2019, 10:33:33 pm »

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
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #1 on: October 24, 2019, 06:04:42 am »

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: [Select]
=Replace([Work],ORANGE,APPLE)
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.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #2 on: October 24, 2019, 07:51:54 am »

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
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #3 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

EDIT: I figured it out, I had a <SPACE> between "Replace" and "(" .  I guess that tells you I'm no coder. Details matter!
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2661
Re: Batch replace tag conent
« Reply #4 on: October 24, 2019, 08:24:49 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

You've got an extra space in your expression.

Code: [Select]
=Replace([Name],K. ,KV)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #5 on: October 24, 2019, 08:32:58 am »

Darn you Bryan C!!!  :)

I just spend 5 minutes figuring that out.  Nice job.

HaWi:  You will probably enjoy using Expression Columns for this kind of work.  Expression Columns let you SEE the results of your expression before applying it to a field.  To make an Expression Column:

Go to a view that has a list of your songs.  Right click on the top area that shows the names of the existing columns (like Name, Album, etc).  Select "Add Expression Column".  Give it a title.  Now type in the expression you want to test out.  You will see a new column with the results of the expression.

Now you can play with expressions and see what they are going to do before you apply them.  You can do many variations and refine your expressions, develop more complex ones, and learn.

Once you have a perfect expression in a column, just copy it out of the expression area and paste it into the Tag window where you want to change values. 

I hope this helps.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #6 on: October 24, 2019, 09:27:01 am »

You've got an extra space in your expression.

Code: [Select]
=Replace([Name],K. ,KV)

Amazing, you have a great eye! Took you no time to figure it out.
 Thanks so much.

Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #7 on: October 24, 2019, 09:29:14 am »

Darn you Bryan C!!!  :)

I just spend 5 minutes figuring that out.  Nice job.

HaWi:  You will probably enjoy using Expression Columns for this kind of work.  Expression Columns let you SEE the results of your expression before applying it to a field.  To make an Expression Column:

Go to a view that has a list of your songs.  Right click on the top area that shows the names of the existing columns (like Name, Album, etc).  Select "Add Expression Column".  Give it a title.  Now type in the expression you want to test out.  You will see a new column with the results of the expression.

Now you can play with expressions and see what they are going to do before you apply them.  You can do many variations and refine your expressions, develop more complex ones, and learn.

Once you have a perfect expression in a column, just copy it out of the expression area and paste it into the Tag window where you want to change values. 

I hope this helps.

Brian.

Thanks Brian, that is excellent advice! Took me a lot of "Undo's" to figure out how to insert a white space...
cheers,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #8 on: October 24, 2019, 09:36:40 am »

Here's one that I can't figure out.
I have the Composer tag filled with LastName, FirstName (BirthYear - DeathYear) and I would like to add the LastName part of the Composer tag to the beginning of the corresponding Name tag.
So, in the Name tag going from "original_name" to "LastName: original_name"
That looks like it is going to require a more complicated expression. Is it doable?
Many thanks!
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #9 on: October 24, 2019, 09:57:48 am »

Now type in the expression you want to test out.  You will see a new column with the results of the expression.

Brian, sorry, I'm a bit slow, I generated the Expression Column but where exactly do I type my Expression?
Many thanks
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #10 on: October 24, 2019, 12:10:11 pm »

Brian, sorry, I'm a bit slow, I generated the Expression Column but where exactly do I type my Expression?

The dialog box for an expression column should have two little boxes:  One for the title.  A second (bigger box) for the expression.  Type the expression into the bigger box, which is labeled "Expression".

Good luck.

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #11 on: October 24, 2019, 12:17:00 pm »

I have the Composer tag filled with LastName, FirstName (BirthYear - DeathYear) and I would like to add the LastName part of the Composer tag to the beginning of the corresponding Name tag.
So, in the Name tag going from "original_name" to "LastName: original_name"
That looks like it is going to require a more complicated expression. Is it doable?

I think it's doable.  As you said, it's probably a good bit more complex.  But doable.  You will probably want to use regular expressions for this, but there might be other ways too.

I'm going to blindly type some code that might do something good.  Or it might not.  You might want to give us a few examples to work with so we can be more sure of the source data.

To get the LastName part extracted from composer, something like this should work:

Code: [Select]
regex([Composer],/#^(.+),\s+#/,-1,0)[R1]
Try that in an expression column and see if it extracts your LastName part or not.  That probably looks extremely confusing; it's not too bad after you understand a few things.  You might want to read my little tutorial on regex with JRiver MC:

https://yabb.jriver.com/interact/index.php?topic=97996.0

Once we get the LastName part, the rest should be quite easy.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #12 on: October 24, 2019, 07:47:15 pm »

The dialog box for an expression column should have two little boxes:  One for the title.  A second (bigger box) for the expression.  Type the expression into the bigger box, which is labeled "Expression".

Good luck.

Brian.

Thank you Brian! Got it. It’s really useful. I love it. It’s saving me so much time.
Best wishes,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #13 on: October 24, 2019, 08:15:19 pm »

I think it's doable.  As you said, it's probably a good bit more complex.  But doable.  You will probably want to use regular expressions for this, but there might be other ways too.

I'm going to blindly type some code that might do something good.  Or it might not.  You might want to give us a few examples to work with so we can be more sure of the source data.

To get the LastName part extracted from composer, something like this should work:

Code: [Select]
regex([Composer],/#^(.+),\s+#/,-1,0)[R1]
Try that in an expression column and see if it extracts your LastName part or not.  That probably looks extremely confusing; it's not too bad after you understand a few things.  You might want to read my little tutorial on regex with JRiver MC:

https://yabb.jriver.com/interact/index.php?topic=97996.0

Once we get the LastName part, the rest should be quite easy.

Brian.

Thank you Brian! I'll give this a go. I have so far managed to add a LastName by using this expression
=Replace([Name],Field(Name, 0),LastName: Field(Name,0))
which is great for albums with mainly one Composer so I extract it "manually". I do have a few compilations with lots o different composers and for those I'd  like do extract the LastName from the Composer tag and add it to the beginning of the Name tag with an expression. For example:
Mass In B Minor, BWV 232 - Kyrie: Kyrie Eleison is in the Name field
Bach, Johann Sebastian (1685-1750) is in the Composer filed
and 'd like to extract the Bach from the Composer field and add it to the Name field to  result in
Bach: Mass In B Minor, BWV 232 - Kyrie: Kyrie Eleison

So if I can combine your expression to extract the LastName and combine it with my expression that should yield the desired result. I'll try tomorrow.

My sincere gratitude for your help! You guys are great.

Cheers,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #14 on: October 25, 2019, 08:46:04 am »

I have so far managed to add a LastName by using this expression
=Replace([Name],Field(Name, 0),LastName: Field(Name,0))

That looks like it will put the text "LastName" into your field.  That's not what I was trying to suggest.

My expression looks for something like:

Beethoven, stustuf stuff stuff stuff

IT's just looking for a word, then a comma, and then a space.  All at the beginning of a field.  So it will match on any word that's at the beginning, as long as it has a comma and a space after it.  That way it can match the last name of any composer as long as it's the first word in the field.

Hopefully you have not altered your fields yet.  If you have, you can roll back to an older database backup.  Or we can figure out how to remove the unneeded text.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #15 on: October 25, 2019, 09:58:47 am »

Brian your expression works! It correctly extracts the LastName from the Composer tag. BRILLIANT!
I am now going to try to us it to add that to the beginning of the Name tag.

Thank you so much!

Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #16 on: October 25, 2019, 10:03:12 am »

Wow, Brian, this is so amazing. Using
=Replace([Name],Field(Name, 0),regex([Composer],/#^(.+),\s+#/,-1,0)[R1]: Field(Name,0))
I can now pull the Composer's LastName into the Name tag. Absolutely brilliant.

Brian, you are a STAR!
many thanks again

Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #17 on: October 26, 2019, 03:46:18 pm »

Thank you for the kind words.  I'm glad I could help you.  :)

Good luck with the rest of your project and MC in general.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #18 on: October 27, 2019, 12:39:56 pm »

Thank you, Brian!
May I bother you one more time? I am trying to replace a comma "," but just inserting a comma obviously doesn't work. Is there a code (like ASCII or HEX) I can use instead?

many thanks,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #19 on: October 27, 2019, 03:46:12 pm »

Comma has special meaning in MC expression language.  You can "escape" it, by putting a slash before it.  So:

Code: [Select]
/,
See the expression language documentation for more details:

https://wiki.jriver.com/index.php/Expression_Language#Expression_Language_Syntax

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #20 on: October 28, 2019, 07:43:39 am »

Thank you so much Brian! This is really saving me so much time. Priceless!
cheer,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #21 on: October 31, 2019, 08:02:34 am »

I am making great progress on my Classical Music library. There is one more thing I couldn't find. How do I use wild cards? Is it possible to use wild cards in expressions? I have tried to use "?" and "." for single characters but didn't succeed. Is there a trick I am missing?
many thanks!
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #22 on: October 31, 2019, 10:08:30 am »

As far as I know, only the Regex() function allows you to use wildcards.  Though they have to be the specific regex wildcards.

What are you trying to do?

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #23 on: October 31, 2019, 02:33:34 pm »

Thanks Brian!
I have a few albums where track names contain text01, text01, text03, ..., text10, and I'd  like to remove those altogether like =Replace([Name],text??,text) where the ? would be the wild card for a single character at that position.
many thanks,

Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #24 on: October 31, 2019, 02:43:05 pm »

I'm afraid I just ran into a bigger issue. MC keeps crashing to Desktop when it starts up. I had a few sporadic crashes earlier but could restart. Now, the crash happens at start-up. Crash log attached.
Many thanks for any help!
Hans
EDIT: Pressing "Reopen" straight at the Crash Report window does get MC25 back up.
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #25 on: October 31, 2019, 03:18:05 pm »

I can't help a lot with the crash, but I'll say this:

Try rebooting your computer and then relaunching MC.  If the problem persists, the developers will probably want to see an MC log.  This is not the same as the crash log that comes up as a pop up.  It's a separate MC logging facility that you have to enable.  Details in the Wiki:

https://wiki.jriver.com/index.php/Logging

I'll answer the other question in a separate reply.

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #26 on: October 31, 2019, 03:29:06 pm »

I have a few albums where track names contain text01, text01, text03, ..., text10, and I'd  like to remove those altogether like =Replace([Name],text??,text) where the ? would be the wild card for a single character at that position.

That's a nearly perfect job for regex.  Let's see...  If there's DEFINITELY nothing after the digits that you want, then something like this will work:

Code: [Select]
regex([Name],/#^([^\d]+)\d+#/,-1,0)[R1]
I've only done a quick little test on this, so it migth not be perfect.  You should learn how these work.  Let me break this one down for you:

/# :  Start of the REGEX
^ : this marks the start of the field.  This is important because it anchors the expression to the very beginning of the line
( stuff stuff stuff ) :  These parenthesis separate off something I want to save for later... in this case it's the text without the digits.  Inside those parenthesis we have:
[^\d]+ :  [ and ] define a range of characters.  In this case I'm saying "\d" which means "digits".  But what's that ^ character before it?  That means to invert the match.  So everything EXCEPT for digits are the characters I want to match.  Now there's a + outside of the [] .  The + means to match on one or more instances of this character (which is not a digit).  Whew.
\d+ :  You guessed it, this means I want to see one or more digits *after* I match the stuff before it.
/# :  End of the REGEX

The net effect is that I grab all the stuff before the digits, but not the digits themselves.  Those are saved into my first "buffer", R1.  So at the end of the expression, I put in [R1], which makes it print the value of R1.  Done!

Give it a try and see if it works for you.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #27 on: November 01, 2019, 12:17:41 pm »

I can't help a lot with the crash, but I'll say this:

Try rebooting your computer and then relaunching MC.  If the problem persists, the developers will probably want to see an MC log.  This is not the same as the crash log that comes up as a pop up.  It's a separate MC logging facility that you have to enable.  Details in the Wiki:

https://wiki.jriver.com/index.php/Logging

I'll answer the other question in a separate reply.

Brian.

Thank you Brian!
I haven’t had a crash since so I’ll blame it on a Catalina quirk.

Cheers
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #28 on: November 01, 2019, 12:26:43 pm »

That's a nearly perfect job for regex.  Let's see...  If there's DEFINITELY nothing after the digits that you want, then something like this will work:

Code: [Select]
regex([Name],/#^([^\d]+)\d+#/,-1,0)[R1]
I've only done a quick little test on this, so it migth not be perfect.  You should learn how these work.  Let me break this one down for you:

/# :  Start of the REGEX
^ : this marks the start of the field.  This is important because it anchors the expression to the very beginning of the line
( stuff stuff stuff ) :  These parenthesis separate off something I want to save for later... in this case it's the text without the digits.  Inside those parenthesis we have:
[^\d]+ :  [ and ] define a range of characters.  In this case I'm saying "\d" which means "digits".  But what's that ^ character before it?  That means to invert the match.  So everything EXCEPT for digits are the characters I want to match.  Now there's a + outside of the [] .  The + means to match on one or more instances of this character (which is not a digit).  Whew.
\d+ :  You guessed it, this means I want to see one or more digits *after* I match the stuff before it.
/# :  End of the REGEX

The net effect is that I grab all the stuff before the digits, but not the digits themselves.  Those are saved into my first "buffer", R1.  So at the end of the expression, I put in [R1], which makes it print the value of R1.  Done!

Give it a try and see if it works for you.

Brian.

Thank you Brian!

This look pretty complicated. I’ll give it a go. Is have to admit I was not precise enough, though. There is almost always some more text after the few characters I’d like to delete. So it really looks like this:

word ... word01 word word
where I’d like to delete only the 01

I’ll have another go at looking at the Regex rules but I might be faster doing it manually.

As always, thank you so much for your help!

Best wishes,
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch replace tag conent
« Reply #29 on: November 01, 2019, 12:32:26 pm »

This look pretty complicated. I’ll give it a go. Is have to admit I was not precise enough, though. There is almost always some more text after the few characters I’d like to delete. So it really looks like this:

word ... word01 word word
where I’d like to delete only the 01

Here's another regex that *might* remove cases like you described above.  This is untested:

Code: [Select]
regex([Name],/#^([^\d]+)\d+([^\d]*)$#/,-1,0)[R1][R2]
This will only work if the "stuff" after the 01 has no digits.

Good luck.

Brian.
Logged

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #30 on: November 01, 2019, 12:48:35 pm »

Thank you Brian!
I can’t express how much I appreciate your help!

Cheers
Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro

HaWi

  • Citizen of the Universe
  • *****
  • Posts: 946
Re: Batch replace tag conent
« Reply #31 on: November 01, 2019, 04:35:24 pm »

I had another crash. Tried to attach the MC25 log but got a "file is too large" error. It was zipped...
I put it on DropBox and you can find it here: https://www.dropbox.com/s/34kdw4bd34qxv95/JRiver%20Log%202019-11-01%2015-34-53.zip?dl=0
 many thanks,

Hans
Logged
rPi5/8GB, Debian 12 Bookworm on SSD | JRMark (33.0.37 64 bit): 2784
MacBookPro (2013), 2.6 GHz Quad-Core Intel Core i7, MacOS 11.7.17 | JRMark (33.0.41 64 bit): 3826
Mac Studio M2 Max, 64GB, 1TB SSD, macOS Sequoia 15.1.1 | JRMark (33.0.41 64 bit): 9056
Docker Container (shiomax) DS1819+ | JRMark (33.0.37 64 bit): 1431
JRemote 3.43
MO 4Media 1.5.7 | Marantz SR7007 (RSL 5.1) HDMI to MacBookPro
Pages: [1]   Go Up