murdos/musicbrainz-userscripts — pull request #17 by 96187 (2014-08-15 05:26:27+00:00)
Title: Add support for more medium formats and a few other fixes

This adds a mapping for Unofficial Release, Album, EP, Mini-Album, "CD, Mini", VCD, SVCD, CD+G, HDCD, DVD-Audio and DVD-Video. It also changes the mappings for CDV (from "CD" to "CDV", now that "CDV" is available in MB), Floppy Disk (from being broken to "Other") and "Memory Stick" (from "Digital Media" to "Other", since we've also moved "USB Flash Drive" and "slotMusic" from "Digital Media" to "Other").

While adding support for the other primary types, I coincidentally ended up testing something marked as both Single and Compilation and noticed it wouldn't be able to seed both types, so I added a new secondary_types array, while continuing to use the existing type variable for the primary type. The release editor doesn't actually make a distinction in the seeding format, but since there can only be one primary type, I thought it would be a good idea to keep the existing variable and would avoid breaking other scripts using the helper functions.

mediums.i.position was removed from the release editor seeding because it was never supported originally and when we did briefly add support for it, it caused more problems than it fixed. Now the seeding format expects mediums to be seeded in the correct order, which already happens here, and shows a warning about unsupported fields being seeded, so removing it here makes the warning go away.

I don't understand why changing the check for unsafeWindow here makes it work in Opera, but it does. Someone else suggested it to me and also didn't know why it works, just that it does.

The change on line 424 (before), line 430 (after) was needed to make the import button appear on some releases (it fixes the import button not showing up for the releases mentioned in both #13 and #15 for me). It seems to happen when the script is having trouble matching the formats and the mediums, e.g. the release in #13 gets imported as one large medium rather than four smaller ones while the release in #15 gets imported as two mediums when it appears to really be just one. Is it better for the import button to not appear if there's a problem parsing where the mediums are split, or better to be able to import most of it even if it needs some manual fixing? I'm not sure...

I tried all the formats I changed in both Opera 12.02 and Firefox 20 and things seem to be working fine in both, except that seeding "compilation" doesn't seem to work at all (I need to report that...).