Bandcamp UPC/barcodes and the importer

Kia ora!

@iolomorganwg found some discrepancies which we’ve been discussing:
https://musicbrainz.org/edit/87427837

It’s given me a massive headache so I was wondering if anyone else would like to have a peep. Maybe someone with some actual understanding of what the code in the ‘upc’ containing row of a Bandcamp page actually does. Rather than my ham-fisted manual testing.

Summary:
It seems like @murdos import Bandcamp to musicbrainz always exposes the last UPC in the code, at the bottom of the page, like so:
image

However the order of the UPC’s in the code row seems unpredictable, and not always the digital last, meaning this is not reliable if there are merch items on the page. Can anyone confirm? And if so is there a possible fix? (the dream!)

When the importer actually pre-populates the barcode field I have no idea, that has always seemed unpredictable to me, just in case anyone can shed any light there. It’s failed to do so in my tests with barcode set to digital and/or merch, but on other releases sometimes it does…

4 Likes

I submitted a PR some time ago that changed the logic in the script so that the release UPC is not set unless digital is the only available medium:

This was to avoid instances like you are discussing here. However Bandcamp does have a per medium UPC field in the page JSON, so I think a fix is possible.

Here’s the output from my Bandcamp release page parser:

> br = Djembe::Bandcamp.album("https://myonlydesirerecords.bandcamp.com/album/love-and-understanding-citadel-room-315-sweden-74")
> puts JSON.pretty_generate(br.releases)
[
  {
    "id": "https://myonlydesirerecords.bandcamp.com/album/love-and-understanding-citadel-room-315-sweden-74",
    "name": "Love and Understanding: Citadel/Room 315 Sweden '74",
    "description": "Includes high-quality download in MP3, FLAC and more. Paying supporters also get unlimited streaming via the free Bandcamp app.",
    "format": "DigitalFormat",
    "identifier": "5052442016687",
    "type": "Digital",
    "images": [
      "https://f4.bcbits.com/img/a2110588555_10.jpg"
    ],
    "currency": "GBP",
    "price": 7.0
  },
  {
    "id": "https://myonlydesirerecords.bandcamp.com/album/love-and-understanding-citadel-room-315-sweden-74#p207737587",
    "name": "Limited Edition Compact Disc",
    "description": "CD packaged in 'mini-LP' gatefold sleeve with insert and additional photos.",
    "format": "CDFormat",
    "identifier": null,
    "type": "Compact Disc (CD)",
    "images": [
      "https://f4.bcbits.com/img/0018653577_10.jpg",
      "https://f4.bcbits.com/img/0018653578_10.jpg",
      "https://f4.bcbits.com/img/0018653579_10.jpg"
    ],
    "currency": "GBP",
    "price": 10.0
  },
  {
    "id": "https://myonlydesirerecords.bandcamp.com/album/love-and-understanding-citadel-room-315-sweden-74#p862471893",
    "name": "Limited Edition Double Vinyl",
    "description": "Limited edition, high quality pressing of 500 copies. The gatefold sleeve is printed on reverse board with exclusive photos and extensive sleeve notes by Daniel Spicer (Jazzwise, The Wire)",
    "format": "VinylFormat",
    "identifier": null,
    "type": "2 x Vinyl LP",
    "images": [
      "https://f4.bcbits.com/img/0018653462_10.jpg",
      "https://f4.bcbits.com/img/0018653463_10.jpg",
      "https://f4.bcbits.com/img/0018653467_10.jpg",
      "https://f4.bcbits.com/img/0018653469_10.jpg"
    ],
    "currency": "GBP",
    "price": 24.0
  }
]

Note that the UPC is only set on the digital release.

5 Likes

Thank you!!

:raised_hands: I use this script so much so that would be incredible… no pressure though :wink: