INTERACT FORUM

Please login or register.

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

Author Topic: Is there a programming language to read and write to Tags in MC?  (Read 820 times)

baldo

  • Galactic Citizen
  • ****
  • Posts: 311

Is there a programming/coding language that I can learn so that I can do search and edit the Tags of music files for MC?

I don't want to modify MC in any way, I leave that to the experts who have been doing it far longer and better than I ever could.  I want to modify the tags for the files. Something that I can already do manually but I have several thousand files to compare and edit so I need a systematic way of doing automatically.


So here is the problem I want to fix:

I have several thousand files lets say they are all in folder A.  I also have several thousand files in folder B.

For the files in both folder A and folder B, I want to read some of the tags from folder B and assign those same tags to the files in folder A.

For files that are only in Folder B I want to assign one of the tags based upon other criteria from folder B or to manually edit that tag.

If the files are not in folder A and only in Folder B, to leave that file alone and do nothing to it.

I appreciate that there is going to be a coding learning curve involved here and I am happy with that as I am currently learning python and other languages just for my own interest.

Many thanks for your help in advance.

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2959
Re: Is there a programming language to read and wrtie to Tags in MC?
« Reply #1 on: April 03, 2025, 09:08:33 am »

You can use MCWS to do that, with Python, C# or any other language. You can also find MCUtils in the forum - it's a set of python tools for MC that can read/write tags in bulk.

Assuming for sets of A and B files are imported into MC, you can also use some fields and expressions to accomplish what you need in steps. Start by creating a field to classify each file as "onlyA", "onlyB", "A+B".
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2079
Re: Is there a programming language to read and write to Tags in MC?
« Reply #2 on: April 03, 2025, 09:39:42 am »

You can also find MCUtils in the forum - it's a set of python tools for MC that can read/write tags in bulk.
Perl /nitpick
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2959
Re: Is there a programming language to read and write to Tags in MC?
« Reply #3 on: April 03, 2025, 09:54:24 am »

Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and wrtie to Tags in MC?
« Reply #4 on: April 03, 2025, 11:15:11 am »

You can use MCWS to do that, with Python, C# or any other language. You can also find MCUtils in the forum - it's a set of python tools for MC that can read/write tags in bulk.

Assuming for sets of A and B files are imported into MC, you can also use some fields and expressions to accomplish what you need in steps. Start by creating a field to classify each file as "onlyA", "onlyB", "A+B".

That would be great if I can use Python to accomplish what I want to do.  That way I can actually my my Python learning to a real world issue that I personally have.

Can you refer me to MCWS please?  Where can I get more details on that. I have never heard of it or come across it here.

I can also take a look at MCUtils tools.

Many MANY thanks for this.
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #5 on: April 04, 2025, 11:12:24 am »

Hello?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 73160
  • Where did I put my teeth?
Re: Is there a programming language to read and write to Tags in MC?
« Reply #6 on: April 04, 2025, 11:39:00 am »

MCWS is on the JRiver Devzone page on the wiki.
Logged

Richard Martin

  • Galactic Citizen
  • ****
  • Posts: 269
Re: Is there a programming language to read and write to Tags in MC?
« Reply #7 on: April 04, 2025, 11:41:26 am »

Hello?

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

Do you really mean change the tags in rhe files or do you mean modify fields in the jriver library, confusingly also known as tags?

You could use MP3vTag https://www.mp3tag.de/en/ to update the tags in the files and then use jriver menu options to update the library from the files.
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #8 on: April 04, 2025, 01:14:27 pm »

Hi Richard,

I mean change the tags for the files.  I know that JRiver reads the tags and it is possible to modify the Tags from JRiver and mass update the tags from the library and also update the library from the tags.

I want JRiver to be my main front end for viewing and playing music files.  I also want to have a copy of the said audio files on my hard drives. 

I need to write code to do this because there is a clear process for doing it AND there are several thousand files that need to be tagged and modified, hence why I don't want to manually do it one by one within JRiver.

Does that make sense?
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2715
Re: Is there a programming language to read and write to Tags in MC?
« Reply #9 on: April 04, 2025, 01:32:00 pm »

If you don't want to use MC for tagging but would like programmatic control, I'd recommend beets: https://beets.io/
Logged

Richard Martin

  • Galactic Citizen
  • ****
  • Posts: 269
Re: Is there a programming language to read and write to Tags in MC?
« Reply #10 on: April 04, 2025, 01:43:16 pm »

Hi Richard,

I mean change the tags for the files.  I know that JRiver reads the tags and it is possible to modify the Tags from JRiver and mass update the tags from the library and also update the library from the tags.

I want JRiver to be my main front end for viewing and playing music files.  I also want to have a copy of the said audio files on my hard drives. 

I need to write code to do this because there is a clear process for doing it AND there are several thousand files that need to be tagged and modified, hence why I don't want to manually do it one by one within JRiver.

Does that make sense?

Could MP3 Tag's reg ex action help https://docs.mp3tag.de/actions/replace-regexp/
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 73160
  • Where did I put my teeth?
Re: Is there a programming language to read and write to Tags in MC?
« Reply #11 on: April 04, 2025, 02:22:12 pm »

JRiver can automate tagging. Could you describe exactly what you expect or hope to do?
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #12 on: April 07, 2025, 08:20:20 am »

JRiver can automate tagging. Could you describe exactly what you expect or hope to do?

That would be great if I can keep everything within JRiver.

Here is what I said in my OP, with a bit more detail to help clarify.

I have several thousand files lets say they are all in folder A.  I also have several thousand files in folder B.

Folder A 5000 files, say FA1, FA2....FAn. Folder B 4800 files, say FB1 FB2 .. FBn

For the files in both folder A and folder B, I want to read some of the tags from folder B and assign those same tags to the files in folder A.

Look at file FA1 and find the corresponding file in FB1, matching Artist, Album and Track Name.  Just those three parameters.  If there is no identical track name then just match the Artist and Album.  If there is no match for both of these then just match the Artist.

Read the value for say Genre for Folder A ie Genre tag for FA1 is Genre1 and then make the field in Folder B for that equivalent match the same. So Genre in for FB1 become Genre1. 

This matches the Genres in Folder B to the be the same as the Genres for Folder A. 


If the files are not in folder A and only in Folder B, to leave that file alone and do nothing to it.


Hope that this helps. I am trying to write out the explanation as "pseudocode" assuming that you guys with a coding background know what I mean.   

I am just using the tag/field Genre as an example. I also want to edit/populate some of the other tags/fields as well.

Because there are so many files that I want to do this for, I need to have a program that does it rather than manually going through the database and matching them by hand as it were.

Thanks again for you help on this.
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #13 on: April 07, 2025, 08:23:06 am »

Richard / BryanC

I'll take a look at those other suggestions. But if I can, I want to remain within JRiver as much as possible.  Although after a cursory glance at beets.io it might be helpful after I have got up to speed with my Python skills.

Thanks for those suggestions though, they are very much appreciated.
 
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #14 on: April 07, 2025, 08:55:27 am »

Hey BryanC,

Just taken a look at Beets.io

It says that it can look up the Genre of files and update that info on the files.  That's quite useful for what I want to do, so I will take a deeper look at it once my python skills get better.

In the meantime, there are still things that I would like to do via JRiver so I will continue down that both paths for now.
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311
Re: Is there a programming language to read and write to Tags in MC?
« Reply #15 on: Yesterday at 02:11:47 pm »

Hi JimH,

Hope that you are having a good Easter. 

Any luck with this?  I would love to use JRiver to do wha tI want to because its the fastest and most user friendly way to do what I want.

If it would help I can write some Pseudo code to explain what I want to do.

many thanks.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2959
Re: Is there a programming language to read and write to Tags in MC?
« Reply #16 on: Yesterday at 03:53:12 pm »

Hi Baldo,
You'll need to code a script in Python/Perl/C#/Whatever, talking with MC via the MCWS API or using MCUtils toolset. This is not a simple task.

Using MC as a middleman to manage the file tags also implies that ALL files from both folder A and B are imported into MC, which means having lots of duplicate albums/files which you just want to harmonize. Is that the case? And if that's so, I have to ask why you want to have duplicates instead of trying to eliminate them.

It's possible to solve this using a few lines of code in MC's Expression Language but, depending on the size of your collection, this can be veeeeery slow. I wrote ZStats tool that, on top of its primary Playlist management function, can also run these types of slow expressions overnight on a large collection.

If you want to go this route I suggest you play with Zelda to start figuring out the Expression. Hint: you'll need to use FieldQuery().
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 73160
  • Where did I put my teeth?
Re: Is there a programming language to read and write to Tags in MC?
« Reply #17 on: Yesterday at 03:58:33 pm »

If you imported all the files into one library, you could open two tabs, one for each folder.  You can use their location to isolate them in the search window.

Then you could use MC's ability to copy and paste tags from one file to the other.  Ctrl-C, Ctrl Shift V.  You can choose which tags to copy.

Lots of this is on the wiki. 
Logged

baldo

  • Galactic Citizen
  • ****
  • Posts: 311

Thanks Zybex,

You are right, I will have duplicate files in the library. And I want to eliminate those duplicates.  The duplicates will be in the old folder but the files in the old folder contain information that needs to be transferred to the new files in the new folder.

My library contains about 30K files in the new fold and a similar number in the old folder.  However the new folder contains files that are not in the old folder and not all the files in the old folder need to be deleted.  Think of it like a ven diagram with some overlapping files, etc.

Where can I learn more about the expression language?  Where precisely in the wiki?
Logged

zybex

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

Start here:
https://wiki.jriver.com/index.php/Expression_Language

You'll need an expression that returns the Genre from a file matching the current one (the Expression is always executed with the some current file as context). You may need to create a couple of auxiliary fields in MC (simple calculated fields) to classify the files as A or B according to their folder location.
Logged
Pages: [1]   Go Up