Can this be done via a script?

Hello,

I am saving in text files (markdown format) artist information in my music folders. Each folder contains a file "credits.md", with the list of musicians in a format similar to what can be found in wikipedia. For example:

  • J.J. Johnson - trombone
  • Tommy Flanagan - piano (tracks 1 - 7)
  • Paul Chambers - bass (tracks 1 - 6, 8 - 13)

or in more elaborate cases, I add a "session" number in a tag, and have multiple "sessions" in the same file (each session is identified in brackets [ ]):

[1] Tracks 1-8, Rec. Capitol Studios, NYC, February 6, 1964

  • Grady Tate - Drums
  • Gus Johnson - Drums
  • Ernie Shepard - Bass
  • Johnny Hodges - Alto Saxophone
  • Harry Carney - Baritone Saxophone
  • Russell Procope - Alto Saxophone
  • Herbie Jones - Trumpet
  • Ray Nance - Trumpet

[2] Tracks 9-16, Lawrence Brown's All-Stars With Johnny Hodges

Rec. Van Gelder Studio, Englewood Cliffs, NJ, March 8, 1965

  • Ray Nance - cornet
  • Cat Anderson - trumpet
  • Lawrence Brown, Buster Cooper - trombone
  • Johnny Hodges - alto sax
  • Russell Procope - alto sax, clarinet
  • Harold Ashby, Paul Gonsalves - tenor sax
  • Jimmy Jones - piano
  • Richard Davis - bass
  • Gus Johnson - drums
  • Johnny "Brother" Hodges - drums (tracks 11,12)

Is it possible to write a script to import a file in that format, parse it, and update the tags for a given album ?

I would rather not invest time in understanding the scripting functions if at the end of the day this is not possible. So if someone who knows the scripting language well could give me his/her opinion, it would save me a lot of time...

Thanks

It is not quite clear what you mean with

I do not see that you name any tag fields.
But: if you want to copy all of the data of the text file into a single field (e.g. INVOLVEDPEOPLE) in each file, the you simply use an action of the type
"Import text file", see the help:
http://help.mp3tag.de/options_format.html#textfile

The format should be a simple text file - or you would have to write some other actions to get rid of the meta-information.

Thanks for replying. I did not "specify" which tag I would use as I assumed that was not relevant, but I would use the tag "BAND".

When you say "you would have to write some other actions to get rid of the meta-information". Would/could that be done in scripting function ?

"BAND" is no standard tag field - you would probably not see it in most players.
Have a look at the help to see the supported and standard tag fields:
http://help.mp3tag.de/main_tags.html

And scripting: again: the source has to be some kind of text file. Any binary format like the formatted output of a word processor will most likely not work.
If you use e.g. HTML as output format, you would have to get rid of all the <h1>, <LI> and <p> inserts. Or you save the file as real plain text anyway.
To import the data I would choose a field that allows a multiline display in the player - and there are not that many. Probably the most widespread one would be UNSYNCEDLYRICS, yet the type of information that I see is more suitable for INVOLVEDPEOPLE - which sadly is shown by hardly any player.

Thanks. Once again, I do not believe the choice of tag is relevant. I would like to update the "BAND" tag because I use LMS (Logitech Media Server), and the choice of tags is limited. As for the content of the tag, I plan on putting multiple entries seperated by a character, which is something that LMS recognizes and is able to split. For example: the BAND tag in my first example would end up containing:

J.J. Johnson / Tommy Flanagan / Paul Chambers

Now, the source is a text file. It is not a binary format. The source contains exactly what I posted above, which is text. A markdown format is NOT html, it is simply text, with some added symbols (ex: * in front of each line containing names of artists).

Back to my question: does someone know if this can be done ?

Use an action of the type "Import text file".
(I think I already linked the relevant help chapters, so it would be nice if you could have a look at them).

Thanks, but I have already used before "import text file", and you need to specify a format with the filename of each music file, which is not what is contained in my text files.

I have a text file in a music folder, which simply contains a list of musicians, in a specific format, and I just wanted to know if that can somehow be used in a script to update a tag.

Not quite.
If you want to import the contents of the same file into the same field in several files then

  • select those files
  • select the action "import text file"
  • set the fixed name (which also could be %album%.txt)
  • select the target field
    Click OK

OK, thanks. Now in the import process, do you think that the scripting language is sufficiently flexible to:

  • parse lines as the ones I indicated
  • collate them into a tag
  • potentially only update the relevant files based on a correspondance with another tag (ex: a custom "session" tag) ?

you have full range of text manipulating functions, see
http://help.mp3tag.de/main_scripting.html#string
or regular expressions, see
http://help.mp3tag.de/options_format.html#regexp

I would import the raw data into the tag field and then transform it into a suitable format.

I guess I was just asking for an "educated guess", based on what I explained, to avoid the effort of spending a lot of time to understand the scripting language only to find out it could not be done.

I would think that it can be done - but then again, if one knows which functions are available, one might modify the workflow so that not too much of the original idea is left. Who knows.

Just one thing: MP3tag only knows the current track. It does not know anything about "albums". So it may be that such a summarizing piece of data is not suitable in respect to context, not in respect to scripting.

OK, thanks. I do not think handling it track by track would be an issue.