INTERACT FORUM

Please login or register.

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

Author Topic: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?  (Read 10782 times)

lyricslover

  • Recent member
  • *
  • Posts: 7

One of the big advantages of JRiver Media Center is the possibility to read "special" id3-tags from tracks. I'm able to read the informations from the fields
MUSICBRAINZ ALBUM ID
MUSICBRAINZ ARTIST ID
but not from
MUSICBRAINZ_TRACKID (or UFID as it is mentioned here: http://wiki.musicbrainz.org/MusicBrainz_Tag)

Another custom tag that I would like to read is
COMMENT SONGS-DB_CUSTOM1
written from another music library program. The hex values for this part looks like:
Code: [Select]
43 4f 4d 4d 00 00 00 1c 00 00 00 58 58 58 53 6f 6e 67 73 2d 44 42 5f 43 75 73 74 6f 6d 31 00 31 32 30 78 31 31 39 00 00 00 00 00 00 00 00....
or
COMM XXXSongs-DB_Custom1  120x119

I know this wiki page: http://wiki.jriver.com/index.php/File_Properties_%28tags%29
But how do I have to "label" the 2 fields above in JRiver Media Center to read the content from my tracks?
(Tagging programs like Mp3tag seems to read and write them without any problem, but I would be a great help if I could manage this values in the MediaCenter library too.)

Thank you for your help!

Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #1 on: July 22, 2012, 11:53:44 pm »

Would like to see this support.

Could you share in tutorials you have found on how to best utilize MusicBrainz? I have a licensed copy of Jaikoz but haven't gotten around to really digging in even after a few years.

I need get started...
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #2 on: July 23, 2012, 05:46:52 am »


I just created a new field MUSICBRAINZ_ALBUMARTISTID, selected a couple of files and then from the right click menu "Library Tools -> Updated library (from tags)" and it pulled it in fine??

I also have some comments names as you have (from lastfm plugin for musicbrainz picard, I think). They appear to come amalgamated into the Comments fields as below:

Code: [Select]
2010s (Songs-DB_Custom1); Female Vocalists; Female; Melodic; Synth (Songs-DB_Custom2); Canadian; Montreal (Songs-DB_Custom3); Chillout (Songs-DB_Occasion)
I guess if you want to do something with them, you may need to make an expression to split them apart.  Does anyone know if there is a way to have MC parse each comment line differently, or alternatively an expression to split them apart so we can use them as below....

From http://musicbrainz.org/doc/MusicBrainz_Picard/Documentation/Plugins/Lastfmplus it appears:
comment:Songs-DB_Custom1 = Track Decade
comment:Songs-DB_Custom2 = LastFM Category
comment:Songs-DB_Custom3 = Artist or Band country [sometimes has city also]
comment:Songs-DB_Occasion = Track Occasion

Thanks
Craig
Logged

lyricslover

  • Recent member
  • *
  • Posts: 7
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #3 on: July 23, 2012, 07:14:44 am »

I just created a new field MUSICBRAINZ_ALBUMARTISTID, selected a couple of files and then from the right click menu "Library Tools -> Updated library (from tags)" and it pulled it in fine??
As I wrote in my initial post, the id3tag fields:
MUSICBRAINZ ALBUM ID
MUSICBRAINZ ARTIST ID
works fine, nothing special. But the MUSICBRAINZ_TRACKID (or UFID) doesn't work with the same syntax for me.
For you?
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #4 on: July 23, 2012, 07:25:05 am »

sorry, I am bad at reading posts:)  i just tried the track id with the same process (musicbrainz_trackid), updated library and it imported without problem??

Craig

PS: I am having no luck with an expression to pull apart the various comments.  I can't seem to find a "find" function to locate the points in the string from which to use "mid" or similar to get out the data.  Does one of the regex superheroes have a simple expression?
Logged

lyricslover

  • Recent member
  • *
  • Posts: 7
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #5 on: July 23, 2012, 07:40:34 am »

Strange thing: If I add a custom field "MUSICBRAIN_TRACKID" I can not import existing values from my tracks.
If I manually add a value to this custom field and save it back to the track, Mp3tag reads TWO (different) values for the same id3tag. The "original" one is still in the track close to the UFID-Tag. The new one is a ordinary TXXX tag with my manually added value.

I'm looking for a solution to read the existing UFID/MUSICBRAINZ-TRACKID tag, added by programs like Mp3tag, Picard or other programs.

And of course, I'm interested in a regex or substr-solution for the "special" comment fields too.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #6 on: July 23, 2012, 12:20:01 pm »

Strange thing: If I add a custom field "MUSICBRAIN_TRACKID" I can not import existing values from my tracks.

I suppose this is with MP3 ID3v2 tags. I think MP3Tag is doing some special handling and displays "MusicBrainz_TrackID" although there is no such TXXX MusicBrainz_TrackID frame in the file. The ID is instead stored in a UFID frame that MC is not reading, see the link referenced by you and http://id3.org/id3v2.3.0#sec4.1. Support for non TXXX frames, like UFID, must be added by the MC developers (just adding a custom UFID MC field will not work). If you look in the MC format action window you can see that MC is displaying "UFID: <unknown data type>".

Short answer: There is nothing you can do, but ask the MC developers to support the UFID tag.
Logged

lyricslover

  • Recent member
  • *
  • Posts: 7
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #7 on: July 23, 2012, 12:45:05 pm »

I see! Thank you very much for this explanation, vagskal!

What do you think about the other custom tag (COMMENT SONGS-DB_CUSTOM1)?
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #8 on: July 23, 2012, 01:12:49 pm »

Sorry, my regex is a bit rusty. I hope someone more fluent in regex can help you.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #9 on: July 23, 2012, 03:54:39 pm »

OK, I thought some more.

There is a workaround to get the UFID data into MC. Use an external tool like MP3Tag to copy the content of the UFID tag to another tag named Musicbrainz_TracID for example. Then you can import the new tag to an identically named custom MC field. I do this for my pet unsupported standard ID3v2.3 tag TORY.

As regards the Comment field I think you can just use listitem() and replace() to get the data into separate MC custom expression fields provided that the data are consistent. The expression for the first field would be:
Code: [Select]
Replace(ListItem([Comment], 0,/);/ ),/ /(Songs-DB_Custom1)
The expression for the second field would be:
Code: [Select]
Replace(ListItem([Comment], 1,/);/ ),/ /(Songs-DB_Custom2)
Etc.

I am not at my PC at the moment so the above is taken from memory and not tested.
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #10 on: July 23, 2012, 05:57:52 pm »


my musicbrainz_trackid was written by the new musicbrainz picard and appears readable.  if you don't have a bucket load of music, it may be worth running the data through picard and maybe the tags will become readable.

thanks vagskal, it works.... almost.  there are some tracks that are missing some of the DB_Custom fields and hence it sometimes gets a bit messed up.  I guess I need to think of some if..then..else's to accomodate missing items. 

Craig
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #11 on: July 23, 2012, 08:05:33 pm »

This is ugly, but here you go:

regex([comment],
  /#^(?:(.+?) \(Songs-DB_Custom1\)(?:; )?)?(?:(.+?) \(Songs-DB_Custom2\)(?:; )?)?(?:(.+?) \(Songs-DB_Custom3\)(?:; )?)?(?:(.+?) \(Songs-DB_Occasion\))?$#/, 1)

Change the final parameter (the 1) to a 2, 3 or 4 to select the desired field.  If the field is empty, the output will be empty as well.
Logged
The opinions I express represent my own folly.

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #12 on: July 24, 2012, 01:23:17 am »

my musicbrainz_trackid was written by the new musicbrainz picard and appears readable.  if you don't have a bucket load of music, it may be worth running the data through picard and maybe the tags will become readable.

Are you sure they are mp3 files with ID3v2 tags? It works with flac and ogg files because they use free format Vorbis comments instead which MC can read.

The file I was testing had MB tags written by Jaikoz, but the spec the op referenced suggested that Picard was also using the UFID frame. That is also logical since it is in full compliance with the specs for the ID3v2 standard, see the link I referenced. The issue is that MC is not able to read and write all standard ID3v2 tags and that custom MC fields are only capable of reading/writing ID3v2 tags starting with the TXXX frame. The workaround I suggested would copy the data from the UFID tag to a TXXX tag, but this is not very practical since you have to use external tools every time you add files (or use MC to change the corresponding MC field if you like your file tags to be consistent and according to specs).

thanks vagskal, it works.... almost.  there are some tracks that are missing some of the DB_Custom fields and hence it sometimes gets a bit messed up.

Yeah, suspected that and that was why I added the reservation that the data must be consistent. But I see that MrC, the regex expert here, was working the night shift while I was sleeping in my time zone.
Logged

lyricslover

  • Recent member
  • *
  • Posts: 7
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #13 on: July 24, 2012, 04:37:06 am »

Thank you MrC. Unfortunately, your regex doesn't give me any result. I try it without, with 1 and with 2 spaces after the [comment], but there is no result.

I do it at Tools --> Options --> Library & Folders --> Manage Library Fields --> Add New Field
FieldName: MyCustomComment1
Activatet: Calculated data
Expression:
Code: [Select]
regex([comment],  /#^(?:(.+?) \(Songs-DB_Custom1\)(?:; )?)?(?:(.+?) \(Songs-DB_Custom2\)(?:; )?)?(?:(.+?) \(Songs-DB_Custom3\)(?:; )?)?(?:(.+?) \(Songs-DB_Occasion\))?$#/, 1)
What am I doing wrong?

Maybe there is a problem with my tags, because if I test with a simplified command of vagskal's suggestion:
Code: [Select]
ListItem([Comment] , 0)I get the usual content of the comment-field (the same as in the official id3-comment-tag).
But there is no result with:
Code: [Select]
ListItem([Comment] , 1)
ListItem([Comment] , 2)
?
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #14 on: July 24, 2012, 06:45:32 am »

Are you sure they are mp3 files with ID3v2 tags?

You are correct.  Sorry they were flac files, didn't realize there would be a difference.  Can't get the MP3 to work, so I will also put in a +1 for MC to allow the reading of the comment tags possible as it is for the flac. (I can wait if it is something you are likely to get to in the medium term, but if not an indication would good so I can start getting into the habit of going thru vagskal's suggestion with mp3tag)

Thank you Mr C for the regex, it really is wonderful that you help out.  I don't seem to be having JRiverUser's problem.  There is however two peculiarities.  Unfortunately the order in which the Songs-DB_CustomX appears within the comments field is random.  The regex seems to need them in order.  Any easy fix?

Secondly, the use of this calculated field really, really slows down MC (takes about 10 seconds to enter or leave category view with this calculated field).  Is this normal?

Thanks
Craig
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #15 on: July 24, 2012, 07:19:00 am »

@JRiverUser2012:
MrC had better answer regarding regex. I suppose you already tried to just copy the expression from MrC's post into the expression editor. It worked for me then with the sample data provided.

The ListItem() expression needs in this case two arguments. The sample data provided by struct shows that each item (what you would like in one separate field) is delimited by "); ". So: ListItem(Source i.e. [Comment], the order number of item to retrieve beginning with 0 for the first item, the delimiter to use when determining what an item is)

ListItem([Comment],0,/);/ ) should work with the sample data provided and return "2010s (Songs-DB_Custom1", i.e. the first item. It does so when I test it. (The / is just an escape character used to make the expression engine interpret ) and space literally and not as part of the expression language.)

Your simplified expression ListItem([Comment] , 0) should actually return "2010s (Songs-DB_Custom1)" with the sample data provided, since if no list delimiter argument is given the expression should default to use ; as delimiter. So perhaps you should check if your data has the same structure as the sample data. Otherwise it will obviously not work for you.

For testing it might be more convenient to use a temporary test view where you add an expression column with the expression to try out. It saves you some mouse clicks when changing the expression.

@struct:
I have been waiting a couple of years for support for my pet standard ID3v2.3 tag TORY so I would not hold my breathe, but with every new version of MC support for one or a couple of tags are usually added.

MrC had better answer regarding the regex, but I suspect the expression will get even uglier if it is at all possible with the somewhat limited regex capabilities we have now in MC.

Yes, using many or complicated expressions in a view through custom expression fields or in the view itself can slow MC down. I have some complex views that take far more than 10 seconds to load or refresh. It is hard to say what is normal. It is more a question of what you find acceptable to get the added functionality through custom calculated data. The developers are constantly working to optimize MC for speed but they have trouble to keep up with all the complex things users can do with the powerful tools they provide us with.

If you do not add many new files you could make another field of type user data and in the tag action window in this field write =[the name of your calculated field] when all files are selected. That will (take some time and) add values to that field, i.e. the result of the complex expression, and you can use that field in views instead without any slowdown. But you would have to repeat the procedure for any new files you add.
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #16 on: July 24, 2012, 08:29:55 am »


vagskal,

Thanks for information, interesting about the time.

I have a vague recollection of trying to get around this problem with the musicbrainz/lastfm tags a few years ago but gave up.

Is there anything special to be done in MP3Tag to get MC to read new tags?  I have MP3Tag map the unreadable Songs-DB_Custom1 to a new field called Decade and I saved the tags (ID3v2.3 UTF-16 I think) but MC does not see them.

Craig
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #17 on: July 24, 2012, 10:07:06 am »

Could you post a tag dump? Click the top MP3 - time - size line in the lower left tag action window to get to the tag format action window and then right click in the window to copy the raw tag data. Paste it in a post.
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #18 on: July 25, 2012, 06:04:40 pm »


Whatever I was doing, I was doing incorrectly.  I now have the MC unreadble MP3 tags copied to new fields that can be read.

I now need modify MrC's expression to come up with something that will let me get the flac comments to the correct place.  I think I will use the expressions to copy the result to a fixed field as I am finding the delay in forming the views a bit annoying. 

Will let you know if I come up with an expression.

Craig
Logged

rowens

  • Regular Member
  • Recent member
  • *
  • Posts: 40
  • Change this by choosing profile
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #19 on: August 24, 2012, 12:10:24 pm »

Whatever I was doing, I was doing incorrectly.  I now have the MC unreadble MP3 tags copied to new fields that can be read.

Craig

Craig - any chance you can walk through the process you used?  I'm not able to get MC to read the MP3tag tags (Songs-DB_Custom1, etc).. how did you map them in MP3Tag to get MC to import them? 

TIA!
Logged

struct

  • Galactic Citizen
  • ****
  • Posts: 380
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #20 on: September 07, 2012, 04:41:59 pm »


Sorry I didn't see your post for such a long time.  I think this is what I did.

I didn't find a regex expression to do the parsing of the comment field within MC when they were all out of order, so I used MP3tag.  It is one extra step, but really not too painful.

In MP3Tag you can set up an "action" to copy the data from the unreadable field to a custom field which we can then get MC to read.  The action is a "format value".  Select destination field, in my case I named them .LASTFM DECADE, and the "format string" is the field from where you are getting the data, e.g. %Comment Songs-DB_Custom1%.

You set up one of these actions for each of the .LastFM Decade, .LastFM Category, .LastFM Country and .LastFM Occasion.  Select the MP3 files, choose the "actions" to operate on the files, click OK.

You make the same fields within MC, setting them to string or list type as appropriate.  I am never sure whether MC sees external changes to the files (I presume so), so you may have to update library from tags to get it to flush the changes. Add to your views and you are done.

I think this is what I did, and what I have to do to any newly processed files.  I don't think you need to create the .LastFm Country, etc fields within MP3tag, but not sure now.

Let me know if unclear or if I missed something.
Craig
Logged

rowens

  • Regular Member
  • Recent member
  • *
  • Posts: 40
  • Change this by choosing profile
Re: JR 17.0.182: Howto read MusicBrainz Track ID and custom fields?
« Reply #21 on: September 10, 2012, 09:59:03 am »

Thanks Craig.  Appreciate the detailed response.  Setting up the actions in MP3Tag was the missing piece :-)

I've got it working now.  Thanks again!!
Logged
Pages: [1]   Go Up