npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

graphbrainz-extension-discogs

v1.0.0

Published

Discogs GraphQL extension for GraphBrainz.

Downloads

4

Readme

GraphBrainz Extension: Discogs

build status coverage npm version license

Retrieve information about MusicBrainz entities from Discogs using the Discogs API. This project has no affiliation with Discogs.

The extension works by finding Discogs URLs in an entity’s URL relationships. The URL relationship must have the discogs type and point to a Discogs entity of the appropriate type: artist for artists, label for labels, master for release groups, and release for releases.

Try out the live demo! :bulb: Use the “Docs” sidebar or the documentation below to help construct your query.

Installation

To use this extension, install GraphBrainz, then:

$ npm install graphbrainz-extension-discogs
$ GRAPHBRAINZ_EXTENSIONS='["graphbrainz-extension-discogs"]' graphbrainz

Or, if you are using the middleware directly:

import graphbrainz from 'graphbrainz'

const middleware = graphbrainz({
  // Don't forget to add the other extensions you use, too.
  extensions: ['graphbrainz-extension-discogs']
})

Configuration

This extension can be configured using environment variables:

  • DISCOGS_CONSUMER_KEY: The Discogs consumer key to use. This is not strictly required, but will get you more favorable rate limiting.
  • DISCOGS_CONSUMER_SECRET: The Discogs consumer secret to use. This is not strictly required, but will get you more favorable rate limiting.
  • DISCOGS_BASE_URL: The base URL at which to access the Discogs API. Defaults to https://api.discogs.com/.
  • DISCOGS_CACHE_SIZE: The number of items to keep in the cache. Defaults to GRAPHBRAINZ_CACHE_SIZE if defined, or 8192.
  • DISCOGS_CACHE_TTL: The number of seconds to keep items in the cache. Defaults to GRAPHBRAINZ_CACHE_TTL if defined, or 86400000 (one day).

This extension uses its own cache, separate from the MusicBrainz loader cache.

Example Queries

Get community ratings, collection counts, and marketplace info for various releases of OK Computer (try it):

{
  search {
    releases(query: "OK Computer", first: 5) {
      nodes {
        mbid
        title
        discogs {
          year
          country
          forSaleCount
          lowestPrice
          community {
            haveCount
            wantCount
            rating {
              voteCount
              value
            }
          }
        }
      }
    }
  }
}

Schema Types

Objects

Artist

:small_blue_diamond: This type has been extended. See the base schema for a description and additional fields.

Information about the artist on Discogs.

DiscogsArtist

An artist on Discogs.

The ID of the artist on Discogs.

The name of the artist on Discogs.

Commonly found variations of the artist’s name.

The artist’s real name, if the artist is a person who uses a stage name.

A list of Discogs artists that represent the same artist under a different alias.

The URL of the artist’s page on Discogs.

Links to the artist’s official pages on different web properties.

A biography or description of the artist.

A list of images picturing the artist.

A list of members, if the artist is a group.

A description of the quality and completeness of this artist’s data in the Discogs database.

DiscogsArtistCredit

A credited artist on a release, track, etc.

The official or common name of the credited artist.

The artist name as credited on this particular work (the Artist Name Variation, or ANV, in Discogs terms).

Join phrases might include words and/or punctuation to separate artist names as they appear on the release, track, etc.

A list of roles the artist had on the work in question.

A list of tracks or track ranges (e.g. “A1 to A4”) on which the artist is credited.

The artist’s entry on Discogs.

DiscogsArtistMember

A single artist who is a member of a group on Discogs.

Whether or not the member is still active in the group.

The name of the member.

The member’s artist information on Discogs.

DiscogsCommunity

Community statistics regarding an item on Discogs.

The acceptance status.

Information about how Discogs users have rated the item.

The number of Discogs users who have the item in their collection.

The number of Discogs users who want the item.

The Discogs users who have contributed to the item’s data.

The Discogs user who submitted the item.

DiscogsImage

A single image from Discogs.

The URL of the image file.

The image type, primary or secondary.

The image width in pixels.

The image height in pixels.

The URL for a 150x150 thumbnail of the image.

DiscogsLabel

A label on Discogs.

The ID of the label on Discogs.

The name of the label.

The URL of the label on Discogs.

A description of the history of the label.

Information on how to contact a representative of the label.

The parent label, if this label is a subsidiary.

A list of labels that are subsidiaries of this label.

A list of images associated with the label.

A description of the quality and completeness of this label’s data in the Discogs database.

DiscogsMaster

Master releases group different versions of the same release (for example, releases in different formats, issued in different countries, re-releases, etc.). The equivalent of a MusicBrainz release group.

The ID of the master on Discogs.

The title of the master.

The URL of the master on Discogs.

The artists credited on the master.

The primary musical genres of the master (e.g. “Electronic”).

The primary musical styles of the master (e.g. “Techno”, “Minimal”).

The number of listings the master currently has on the marketplace.

The lowest price for the master currently found on the marketplace.

The three-letter currency code for which to retrieve the price. Discogs supports USD, GBP, EUR, CAD, AUD, JPY, CHF, MXN, BRL, NZD, SEK, and ZAR.

[NOT YET WORKING]

The year the master was released (most likely its “main” release).

The main release from the master.

Images of the master.

Music videos from the master.

A description of the quality and completeness of this master’s data in the Discogs database.

DiscogsRating

An aggregated rating on Discogs.

The number of users who have contributed to the rating.

The average rating as determined by users.

DiscogsRelease

A release on Discogs.

The ID of the release on Discogs.

The title of the release.

The URL of the release on Discogs.

The artists credited on the release.

An additional list of artists who contributed to the release, but are not named in the release’s artists.

The primary musical genres of the release (e.g. “Electronic”).

The primary musical styles of the release (e.g. “Techno”, “Minimal”).

The number of listings the release currently has on the marketplace.

The lowest price for the release currently found on the marketplace.

The three-letter currency code for which to retrieve the price. Discogs supports USD, GBP, EUR, CAD, AUD, JPY, CHF, MXN, BRL, NZD, SEK, and ZAR.

[NOT YET WORKING]

The year the release was issued.

Notes about the release.

The country in which the release was issued.

The master release on Discogs.

The primary thumbnail image for the release.

Images of the release.

Music videos from the release.

Information about the Discogs community’s contributions to the release’s data.

A description of the quality and completeness of this release’s data in the Discogs database.

DiscogsReleaseConnection

A connection to a list of Discogs releases.

Information to aid in pagination.

A list of edges.

A list of nodes in the connection (without going through the edges field).

A count of the total number of items in this connection, ignoring pagination.

DiscogsReleaseEdge

An edge in a Discogs release connection.

The release at the end of the edge.

DiscogsUser

A user on Discogs.

The user’s username on Discogs.

DiscogsVideo

A single video linked from Discogs.

The URL of the video.

The title of the video.

The video description.

The duration of the video in milliseconds.

Whether the video is embeddable.

Label

:small_blue_diamond: This type has been extended. See the base schema for a description and additional fields.

Information about the label on Discogs.

Release

:small_blue_diamond: This type has been extended. See the base schema for a description and additional fields.

Information about the release on Discogs.

ReleaseGroup

:small_blue_diamond: This type has been extended. See the base schema for a description and additional fields.

Information about the release group on Discogs.

Enums

DiscogsImageType

The type of image.

The primary image representing the item.

A secondary image representing the item.