Preliminary Musicbrainz support


#1

In the Web Sources Archive thread, I've added a beta Musicbrainz script. It seems to work on most albums, but there are some exceptions. I'm a big fan of Musicbrainz and think they have the most accurate database out there (better than AMG), so I'm glad this web sources scripting was so easy to work with. Try it out and post how it works (or doesn't work) for you.

-Will


Problem with special characters at Tag - Filename
#2

Another question...I was just searching Musicbrainz for "Requiem For A Dream" (soundtrack), and it didn't work because there wasn't any cover art for that album on the webpage. In the script, is there any way to skip over a section when findline fails? Like if it can't find the line where the cover.jpg should be, is there a way for the script to continue parsing the rest of the album info (tracks and such)?


#3

You can use # coverurl

outputto "coverurl"
findline "src=\"http://images.amazon.com/" 1 1
if "   src"
    findinline "src=\"http://images.amazon.com/"
    say "http://images.amazon.com/"
    sayuntil "\""
else
    gotoline 1
endif

for the Cover URL. findline find the first line containing the string specified and the 1 as third parameters ignores the error, when no line was found. Please note, that the cursors position is at the end of the file in this case.

# year
findline "Edit releases" 1 1
outputto "year"
findinline "<td"
ifnot " "
    findinline ">"
    sayuntil "-"
endif will also fix an error when no release was specified on the album page.

I'm also working on a solution, to query albums where the web source redirects directly to the album page.

Best regards,
~ Florian


#4

I've added a modified web source to the archive which also allows to query albums where the web source redirects directly to the album page :slight_smile:

You'll need the current Development Build to use this web source.

Best regards,
~ Florian


#5

Awesome, works great.

I'm still having problems with Mp3tag not translating HTML entities (like &, ', etc.). Is this a bug? Or is there some code I can add to the web sources script or some action script I can use? It's most noticeable with Musicbrainz because they seem to encode almost all non-alphanumeric characters. Try these albums to see what I'm talking about: Le Tigre - This Island, Iron & Wine - Our Endless Numbered Days, U2 - The Joshua Tree. I'm also getting a weird character in the artist field for Sigur Rós - Ba Ba Ti Ki Di Do with Musicbrainz. Just thought I'd give you the heads up. Keep up the good work.

Will


#6

I don't know, if I'll add HTML entities detection and replace it within the web source. This is mainly because I don't know how to replace all (also unknown entities) at once.

But you could create a replace action set in the meantime and replace those entities via an action after using the web source feature. I know this is an additional step and a built-in solution would be much nicer, but I don't have an idea how to translate entities like &#231 ; by now.

Best regards,
~ Florian


#7

There's a good list of all the HTML 4.0 entities here: http://www.w3schools.com/html/html_entitiesref.asp

I whipped up some quick standard actions (attached) to replace the most common entities (', ", &, <, >, , ©), and it works well enough for now. Do you think you could add the functionality to run actions within the web sources dialogs (the "Adjust Tag-information" one at least)? That would save some time.

Also, I noticed the Musicbrainz script wasn't grabbing the year for some reason (on pretty much any album I tried), so I fixed it by doing another findline command before the findinline command (and adding some more text to search for). Also, debugging was on, so I turned it off. I've attached the fixed script below.

Will

Standard.mta (883 Bytes)

musicbrainz.src (2.92 KB)


#8

nice work willmcelwain, but the year comes up with 2

strings at the end

#9

#10

The current version automatically resolves HTML entities now and fixes some weird characters which were caused by not decoding UTF-8 encoded data.


#11

I've been renaming a bunch of my albums recently (thanks to the new HTML entities and UTF-8 bug fixes), and have a couple more feature requests.

  1. Is there a way to automatically rename the working directory, for example to something like "%artist% - %year% - %album%" or something? If not, can you add that functionality (in Options)? Or maybe add a field in the Actions dialog like _WORKINGDIR or something? Also, if you do add this feature, can you also set the renamed directory as the one to start from when clicking on "Change Directory..."?

  2. On the left side of the main window where it specifies Folder, would it be possible to add 2 entries to the drop-down list? Could you add both the previous and the next subfolder of the parent directory? For example, say I'm working in the directory "D:\mp3s\albums\Radiohead - OK Computer". I'd like the drop-down list to also contain the items "D:\mp3s\albums\Radiohead - Amnesiac" and "D:\mp3s\albums\Radiohead - The Bends". That way, I could quickly jump to the next (or previous) directory instead of going through the "Change Directory..." dialog. Or maybe there could also be an option to tell Mp3tag how many previous/next subdirs to have in the list, instead of just one of each.

  3. Is there a way you can enable the sorting of tracks with the other web sources, similar to how it's done with freedb? It'd be helpful when you have an album with no track numbers in the ID3 tags or filenames, which default to being sorted by name.

  4. Can you make it so Mp3tag loads the web sources scripts dynamically, so that when you make a small change to the script, you don't have to exit Mp3tag and restart it for the changes to take affect?

Also, in the Musicbrainz script, the year was sometimes grabbed in the form of YYYY-MM-DD (like 2003-11-23), and since ID3 tags can't hold that many characters, I modified the script (at the very end) to only grab the 4-digit year. I also added functionality to grab info for Various Artists albums (sountracks and whatnot). As a workaround (since the web sources framework doesn't really support multiple artists), I stored the track info as "%artist% / %title%", then wrote an action script to split up each pairing into their respective fields. It's a hack, but it seems to work. Both the updated Musicbrainz script and Various Artists action can be downloaded below.

Thanks!
-Will

musicbrainz.src (3.34 KB)

Various_Artists.mta (133 Bytes)


#12

Any thoughts on these suggestions Florian?

-Will