Skip to main content

Generating QR labels from Discogs collection CSV exports (1)

If you are into collecting records it has probably happened to you: you are at a record fair and wonder whether or not you already have the record you are holding in your hands and you need to decide whether to buy it or not on the spot. It certainly has happened to me: I have bought plenty of duplicates, or was absolutely certain that I had a certain record, only to find out at home that I actually didn't have it.

I sometimes also go through my record collection and see records that look very similar (to illustrate that: I have about 20 different copies of Queen's Greatest Hits) and then wonder what the difference between them is, as I tend to forget the subtle differences. This information is (mostly) recorded in online databases such as Discogs, but I am not always near my computer (strange, but true).

So I was thinking: what can I do to connect these two worlds? One answer I came up with: make labels with QR codes that point to the right release on Discogs and use my smartphone/tablet to scan the QR code and be taken to the right release.

QR codes

QR codes have not been very visible (literally) in the West so far but they are a very big success in for example Japan. One factor contributing to it probably has been the lack of device support: to scan QR codes on Android you first need to install an external scanner app and Apple's iOS currently (iOS 10) also doesn't support QR codes natively (so again: external apps).

However, with the new built-in QR scanner in Apple's iOS 11 (and my guess is that Android will be following soon as well) it will become a lot easier to scan QR codes and they will be more ubiquitous, so QR sounded like the right choice. And, as it turns out, it is a lot easier to create these labels than I first thought it would be.

First you need to get the information about your collection. Luckily Discogs makes this very easy by offering exports of collection data. Yay!

Discogs CSV exports

After logging in on Discogs you can see a tab "Export". After you click on that you are taken to a page where you can export data as CSV for the following:
  • contributions
  • collection
  • wantlist
  • marketplace inventory
  • marketplace orders
  • marketplace order items
As I haven't sold anything yet (so I don't have any marketplace data), and QR codes are not interesting for contributions or a wantlist (how can I put stickers on items that I don't have?) I have only looked at the exports for collection data.

The CSV file exports the following data (in this order):
  1. Catalog number
  2. Artist
  3. Title
  4. Label
  5. Format
  6. Rating
  7. Released
  8. release_id
  9. CollectionFolder
  10. Date Added
  11. Collection Media Condition
  12. Collection Sleeve Condition
  13. Collection Notes
For me most of the information is not very relevant when I have the actual record in front of me, but important to have on the label are:
  • artist
  • title
  • release_id (this is the identifier used in the Discogs database)
and perhaps also the media and sleeve condition (although so far I have not graded my collection) and maybe the catalogue number.

Valid Discogs URLs

The URLs on the Discogs site embed the release_id from the CSV. When clicking on a link you will see the name of the artist and the release, but also the release_id. The names actually don't matter (as it can change if the name of the artist or release is wrong) and internally Discogs only uses the release_id. The URLs. Valid release URLs can therefore be easily constructed as follows:
https://www.discogs.com/release/ + release_id
or, in Python:
"https://www.discogs.com/release/%s" % str(release_id)
and that is really all there is to it.

Generating QR codes

The next step is capturing the URL in a QR code. Generating QR codes on Linux is actually very simple. For example, with the qrencode program you can generate QR codes for basically anything. But, and that's the drawback, that's all it can do. For printing I would want to add text and arrange the data in a grid so I can just buy sheets with different labels.

So I opted to use ReportLab to generate PDF files. ReportLab also has built in functionality to generate QR labels, and it is very good at generating PDFs. The one problem I have with it is that the open source version is horribly underdocumented.

Still, with some fiddling I got it working nicely for a 8x3 grid on A4 format (I happened to have some sheets with 24 labels on them). The result is a program, that you can find in its own GitHub repository (Python3 and released under the GPLv3 license, only tested on Linux). At the moment the parameters (grid dimensions, paper size) are all hardcoded to suit my particular use case, but that will change at some point in the future.

Result mock up

I tested this with a few entries from my collection, printed labels, grabbed a few records and put it the labels on it. The result can be seen below. Please note that the QR codes do not correspond to the records, as it is just a mock up.


I am not entirely satisfied with the result yet: the labels that I used are a bit too small to store all the information that I want to have on them, but it is a good start.

Things to keep in mind

There are a few things to keep in mind, related to printing, labels, and a few other things.

Borderless printing

Most printers cannot print in so called "borderless mode". My particular HP LaserJet model certainly cannot do it.  This means that you likely will have to fiddle a bit with margins to prevent that data is cut from the edges. This can be quite frustrating, so it might be worth checking out other solutions (such as a dedicated label printer). Also, it helps to test in draft mode and with regular paper before you unnecessarily waste labels.

Get the right labels

Labels are actually very cheap: you can buy stacks of them for about 0.01 Euro per sticker in various configurations. Depending on the amount of information you want on the stickers you can explore different formats. I found 24 (8x3) on A4 to be a bit restraining, but I haven't played with any other formats yet. Probably I would go for 14, 15 or 16, or use a dedicated label printer (depending on the price of the labels).

Use plastic sleeves

Needless to say but don't put the stickers directly on the outer sleeve of the record to prevent damaging the sleeve of the record itself. Always use an extra plastic sleeve and put the sticker on that.

Information will change, so make sure it is correct

On a site like Discogs information will always change and it might be that at one point the release your QR code points to is merged into another release. The one solution for that is to make sure that the information on the page is as complete and correct as possible before you print the stickers.

Other uses

The obvious other use besides using it for your own collection is if you are selling items on a record fair and you want your records to be "Discogs-enabled" (although you probably shouldn't call it that, the trademark people might not like it). At 1 cent per sticker it adds a lot of convience for people using Discogs on their phone. Of course, it means that every record that you use a sticker for needs to correspond to the actual item in the database and as I already have said in a previous post that is a lot of work, so it might not worth doing for every record, but just for the more expensive items.

Support in the Discogs app? Not yet.

Currently QR codes like this are not supported in the Discogs app for iOS or Android. I told the staff about it, and also posted about it on the forum, and the answer was "cool idea, but not right now".

From their point of view this is completely understandable: no one (apart from me) is using it right now, so why invest engineering resources in something that is basically unproven? It might turn out that there is absolutely no market for it at all.

However, I am more optimistic about the future: as said before Apple will natively support QR code scanning in the upcoming iOS 11 and my guess is that Google will add native support to Android soon as well.

Future work

I am still exploring how to make the program better. The first step will be to buy a label printer and actually find time to play with it. Then I will be working on removing the hardcoded parameters from the program and see if I can work on various profiles for combinations of label size, information needed on the label and printers.

Comments

Popular posts from this blog

SID codes (part 1)

One thing that I only learned about after using Discogs is the so called Source Identification Code, or SID. These codes were introduced in 1994 to combat piracy and to find out on which machines a CD was made. It was introduced by Philips and adopted by IFPI, and specifications are publicly available which clearly describe the two available SID codes (mastering SID code and mould SID code). Since quite a few months Discogs has two fields available in the " Barcode and Other Identifiers " (BaOI) section: Mould SID code Mastering SID code A few questions immediately popped up in my mind: how many releases don't have a SID field defined when there should be (for example, the free text field indicates it is a SID field)? how many releases have a SID field with values that should not be in the SID field? how many release have a SID field, but a wrong year (as SID codes were only introduced in 1994) how many vinyl releases have a SID code defined (which is impossi...

SPARS codes (part 1)

Let's talk about SPARS codes used on CDs (or CD-like formats). You have most likely seen it used, but maybe don't know its name. The SPARS code is a three letter code indicating if recording, mixing and mastering were analogue or digital. For example they could look like the ones below. There is not a fixed format, so there are other variants as well. Personally I am not paying too much attention to these codes (I simply do not care), but in the classical music world if something was labeled as DDD (so everything digital) companies could ask premium prices. That makes it interesting information to mine and unlock, which is something that Discogs does not allow people to do when searching (yet!) even though it could be a helpful filter. I wanted to see if it can be used as an identifier to tell releases apart (are there similar releases where the only difference is the SPARS code?). SPARS code in Discogs Since a few months SPARS is a separate field in the Discogs ...

Country statistics (part 2)

One thing I wondered about: for how many releases is the country field changed? I looked at the two most recent data dumps (covering February and March 2019) and see where they differed. In total 5274 releases "moved". The top 20 moves are: unknown -> US: 454 Germany -> Europe: 319 UK & Europe -> Europe: 217 unknown -> UK: 178 UK -> Europe: 149 Netherlands -> Europe: 147 unknown -> Europe: 139 unknown -> Germany: 120 UK -> US: 118 Europe -> Germany: 84 US -> UK: 79 USA & Canada -> US: 76 US -> Canada: 65 unknown -> France: 64 UK -> UK & Europe: 62 UK & Europe -> UK: 51 France -> Europe: 51 Saudi Arabia -> United Arab Emirates: 49 US -> Europe: 46 unknown -> Japan: 45 When you think about it these all make sense (there was a big consolidation in Europe in the 1980s and releases for multiple countries were made in a single pressing plant) but there are also a few weird changes:...