Extracting MP3 Tags from a Text File into Keyboard Maestro Variables

I got a couple more question though:

  1. When updating mp3 tags I normally have separate text files for each field.
    So every time I need to get artist name or title or description I open separate file, select everything inside, copy to clipboard.
    Then open mp3 file and paste everything.

Is there is way to have one file with separators, from where I can fetch data to insert into mp3 tags.
here is an example.

I assume each field would be a separate Variable for clipboard and while Keyboard Maestro is running it would get info for each variable in the file, I'm confused how to put it all together.

  1. Another question is if there is a way to update mp3 tags from command prompt. I am currently using "mouse click on image" and MP3TAG app, so it is just a huge mess :smile:)

Thank you!

Hey Costa,

That's simple, although you might not think so if you're unfamiliar with regular expressions. (See macro below.)

I could have used one Search Variable action to extract each tag-block, but I broke it up into six actions ā€“ so the regular expressions would be easier to understand.

This gives you an example of how to pull text out of a text file and parse it into different variables.

(The variables are deleted at the beginning and end of the macro to prevent them from accidentally being reused ā€“ in a production macro I'd add more error-checking.)

I'm not familiar with any command-line MP3 tagging software, but Google unsurprisingly says some exist.

I found this pretty quickly on Stackexchange: Is there a good command-line ID3 tool for OS X?

I was able to install id3lib using MacPorts (I use it instead of Homebrew).

It did install id3tag.

There's not a man page for it, but there is help: id3tag -h

-Chris


Extract MP3 Tags from a File.kmmacros (11 KB)

1 Like

Hey Chris,

Thank you very much for the macros!
I'm grateful and confused at the same time.

I was able to install id3lib library from GitHub and looks like it works.

I was trying to make macros work but failed:(
I hope you can slightly tweek that macros for me.

1.I have 3 files in folder Downloads:
-mix.mp3
-TAGS.txt (or test.txt in your example)
-1440x1440.png

2.I would like to update following fields in mix.mp3 from file TAGS.txt:

-Title
-Artist
-Album
-Track number
-Year
-Genre
-Subtitle
-Comment

3.Add cover art:
-1440x1440.png

4.Add iTunes podcast tag:
Comment [iTunPGAP] = 0

THANK YOU!!! THANK YOU!!! THANK YOU!!!

Hey Costa,

Sorry to take so long to respond. Been busy.

Your test tag file in this post is nothing like the example tag file you posted earlier.

Figure out the exact format you want it to be in and post the file, so I can test with it. (Or send it to me direct to kmforum@thestoneforge.com)

-Chris

Dear Chris,

Thank you for follow up.
Iā€™m attaching 3 files that I would like to use with a macro.

  • a screenshot from MusicBrainz Picard with TAGs inserted.

iTunes tag would never change!

Warm wishes,
Costa

Hey Costa,


http://picard.musicbrainz.org/docs/faq/

ā€œI tagged a file in Picard, but iTunes is not seeing the tags! ā€

Firstly, you need to force iTunes to re-read the information from your tags and update its library. This is discussed in the iTunes Guide.

Additionally, iTunes has a known bug in its ID3v2.4 implementation, which makes it unable to read such tags if they contain also embedded cover art. As a work-around, you can configure Picard to write ID3v2.3 tags.


I'll look at the tags file here after a bit.

-Chris

1 Like

Yeah, no issues here, since I normally update this tag manually, Iā€™m just trying trying to automate stuff :slight_smile:

I also send you files on email. THank you for you time!!!

As in developers guide, itunes user guide (if one exists), or the iTunes help file. This is the first time I have ever heard this.