Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exogen/graphbrainz-extension-discogs
Discogs GraphQL extension for GraphBrainz.
https://github.com/exogen/graphbrainz-extension-discogs
discogs discogs-api graphbrainz graphql graphql-schema musicbrainz musicbrainz-api
Last synced: about 1 month ago
JSON representation
Discogs GraphQL extension for GraphBrainz.
- Host: GitHub
- URL: https://github.com/exogen/graphbrainz-extension-discogs
- Owner: exogen
- License: mit
- Created: 2017-11-17T08:02:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-04T22:44:39.000Z (over 6 years ago)
- Last Synced: 2024-10-01T16:27:24.036Z (about 2 months ago)
- Topics: discogs, discogs-api, graphbrainz, graphql, graphql-schema, musicbrainz, musicbrainz-api
- Language: JavaScript
- Size: 323 KB
- Stars: 7
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphBrainz Extension: Discogs
[![build status](https://img.shields.io/travis/exogen/graphbrainz-extension-discogs/master.svg)](https://travis-ci.org/exogen/graphbrainz-extension-discogs)
[![coverage](https://img.shields.io/codecov/c/github/exogen/graphbrainz-extension-discogs.svg)](https://codecov.io/gh/exogen/graphbrainz-extension-discogs)
[![npm version](https://img.shields.io/npm/v/graphbrainz-extension-discogs.svg)](https://www.npmjs.com/package/graphbrainz-extension-discogs)
[![license](https://img.shields.io/npm/l/graphbrainz-extension-discogs.svg)](https://github.com/exogen/graphbrainz-extension-discogs/blob/master/LICENSE)Retrieve information about MusicBrainz entities from [Discogs](https://www.discogs.com/)
using the [Discogs API](https://www.discogs.com/developers/). 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!][demo]** :bulb: Use the “Docs” sidebar or the
documentation below to help construct your query.## Installation
To use this extension, install [GraphBrainz](https://github.com/exogen/graphbrainz),
then:```console
$ npm install graphbrainz-extension-discogs
$ GRAPHBRAINZ_EXTENSIONS='["graphbrainz-extension-discogs"]' graphbrainz
```Or, if you are using the middleware directly:
```js
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](http://graphbrainz-extension-discogs.herokuapp.com/?query=%7B%0A%20%20search%20%7B%0A%20%20%20%20releases(query%3A%20%22OK%20Computer%22%2C%20first%3A%205)%20%7B%0A%20%20%20%20%20%20nodes%20%7B%0A%20%20%20%20%20%20%20%20mbid%0A%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20discogs%20%7B%0A%20%20%20%20%20%20%20%20%20%20year%0A%20%20%20%20%20%20%20%20%20%20country%0A%20%20%20%20%20%20%20%20%20%20forSaleCount%0A%20%20%20%20%20%20%20%20%20%20lowestPrice%0A%20%20%20%20%20%20%20%20%20%20community%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20haveCount%0A%20%20%20%20%20%20%20%20%20%20%20%20wantCount%0A%20%20%20%20%20%20%20%20%20%20%20%20rating%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20voteCount%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20value%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A)):```graphql
{
search {
releases(query: "OK Computer", first: 5) {
nodes {
mbid
title
discogs {
year
country
forSaleCount
lowestPrice
community {
haveCount
wantCount
rating {
voteCount
value
}
}
}
}
}
}
}
```## Schema Types
Table of Contents
* [Objects](#objects)
* [Artist](#artist)
* [DiscogsArtist](#discogsartist)
* [DiscogsArtistCredit](#discogsartistcredit)
* [DiscogsArtistMember](#discogsartistmember)
* [DiscogsCommunity](#discogscommunity)
* [DiscogsImage](#discogsimage)
* [DiscogsLabel](#discogslabel)
* [DiscogsMaster](#discogsmaster)
* [DiscogsRating](#discogsrating)
* [DiscogsRelease](#discogsrelease)
* [DiscogsReleaseConnection](#discogsreleaseconnection)
* [DiscogsReleaseEdge](#discogsreleaseedge)
* [DiscogsUser](#discogsuser)
* [DiscogsVideo](#discogsvideo)
* [Label](#label)
* [Release](#release)
* [ReleaseGroup](#releasegroup)
* [Enums](#enums)
* [DiscogsImageType](#discogsimagetype)### Objects
#### Artist
:small_blue_diamond: *This type has been extended.
See the [base schema](https://github.com/exogen/graphbrainz/docs/types.md) for a description and additional fields.*Field
Argument
Type
Descriptiondiscogs
DiscogsArtistInformation about the artist on Discogs.
#### DiscogsArtist
An artist on Discogs.
Field
Argument
Type
DescriptionartistID
ID!The ID of the artist on Discogs.
name
String!The name of the artist on Discogs.
nameVariations
[String!]!Commonly found variations of the artist’s name.
realName
StringThe artist’s real name, if the artist is a person who uses a stage name.
aliases
[DiscogsArtist!]!A list of Discogs artists that represent the same artist under a different
alias.url
URLString!The URL of the artist’s page on Discogs.
urls
[URLString!]!Links to the artist’s official pages on different web properties.
profile
StringA biography or description of the artist.
images
[DiscogsImage!]!A list of images picturing the artist.
members
[DiscogsArtistMember!]!A list of members, if the artist is a group.
dataQuality
StringA description of the quality and completeness of this artist’s data in the
Discogs database.#### DiscogsArtistCredit
A credited artist on a release, track, etc.
Field
Argument
Type
Descriptionname
StringThe official or common name of the credited artist.
nameVariation
StringThe artist name as credited on this particular work (the Artist Name
Variation, or ANV, in Discogs terms).joinPhrase
StringJoin phrases might include words and/or punctuation to separate artist
names as they appear on the release, track, etc.roles
[String!]!A list of roles the artist had on the work in question.
tracks
[String!]!A list of tracks or track ranges (e.g. “A1 to A4”) on which the artist is
credited.artist
DiscogsArtistThe artist’s entry on Discogs.
#### DiscogsArtistMember
A single artist who is a member of a group on Discogs.
Field
Argument
Type
Descriptionactive
BooleanWhether or not the member is still active in the group.
name
String!The name of the member.
artist
DiscogsArtistThe member’s artist information on Discogs.
#### DiscogsCommunity
Community statistics regarding an item on Discogs.
Field
Argument
Type
Descriptionstatus
StringThe acceptance status.
rating
DiscogsRatingInformation about how Discogs users have rated the item.
haveCount
IntThe number of Discogs users who have the item in their collection.
wantCount
IntThe number of Discogs users who want the item.
contributors
[DiscogsUser!]!The Discogs users who have contributed to the item’s data.
submitter
DiscogsUserThe Discogs user who submitted the item.
#### DiscogsImage
A single image from Discogs.
Field
Argument
Type
Descriptionurl
URLString!The URL of the image file.
type
DiscogsImageType!The image type, primary or secondary.
width
Int!The image width in pixels.
height
Int!The image height in pixels.
thumbnail
URLStringThe URL for a 150x150 thumbnail of the image.
#### DiscogsLabel
A label on Discogs.
Field
Argument
Type
DescriptionlabelID
ID!The ID of the label on Discogs.
name
String!The name of the label.
url
URLString!The URL of the label on Discogs.
profile
StringA description of the history of the label.
contactInfo
StringInformation on how to contact a representative of the label.
parentLabel
DiscogsLabelThe parent label, if this label is a subsidiary.
subLabels
[DiscogsLabel!]!A list of labels that are subsidiaries of this label.
images
[DiscogsImage!]!A list of images associated with the label.
dataQuality
StringA 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.Field
Argument
Type
DescriptionmasterID
ID!The ID of the master on Discogs.
title
String!The title of the master.
url
URLString!The URL of the master on Discogs.
artistCredits
[DiscogsArtistCredit!]!The artists credited on the master.
genres
[String!]!The primary musical genres of the master (e.g. “Electronic”).
styles
[String!]!The primary musical styles of the master (e.g. “Techno”, “Minimal”).
forSaleCount
IntThe number of listings the master currently has on the marketplace.
lowestPrice
FloatThe lowest price for the master currently found on the marketplace.
currency
StringThe 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]year
IntThe year the master was released (most likely its “main” release).
mainRelease
DiscogsReleaseThe main release from the master.
images
[DiscogsImage!]!Images of the master.
videos
[DiscogsVideo!]!Music videos from the master.
dataQuality
StringA description of the quality and completeness of this master’s data in the
Discogs database.#### DiscogsRating
An aggregated rating on Discogs.
Field
Argument
Type
DescriptionvoteCount
Int!The number of users who have contributed to the rating.
value
FloatThe average rating as determined by users.
#### DiscogsRelease
A release on Discogs.
Field
Argument
Type
DescriptionreleaseID
ID!The ID of the release on Discogs.
title
String!The title of the release.
url
URLString!The URL of the release on Discogs.
artistCredits
[DiscogsArtistCredit!]!The artists credited on the release.
extraArtistCredits
[DiscogsArtistCredit!]!An additional list of artists who contributed to the release, but are not
named in the release’s artists.genres
[String!]!The primary musical genres of the release (e.g. “Electronic”).
styles
[String!]!The primary musical styles of the release (e.g. “Techno”, “Minimal”).
forSaleCount
IntThe number of listings the release currently has on the marketplace.
lowestPrice
FloatThe lowest price for the release currently found on the marketplace.
currency
StringThe 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]year
IntThe year the release was issued.
notes
StringNotes about the release.
country
StringThe country in which the release was issued.
master
DiscogsMasterThe master release on Discogs.
thumbnail
URLStringThe primary thumbnail image for the release.
images
[DiscogsImage!]!Images of the release.
videos
[DiscogsVideo!]!Music videos from the release.
community
DiscogsCommunityInformation about the Discogs community’s contributions to the release’s
data.dataQuality
StringA description of the quality and completeness of this release’s data in
the Discogs database.#### DiscogsReleaseConnection
A connection to a list of Discogs releases.
Field
Argument
Type
DescriptionpageInfo
PageInfo!Information to aid in pagination.
edges
[DiscogsReleaseEdge!]!A list of edges.
nodes
[DiscogsRelease!]!A list of nodes in the connection (without going through the `edges` field).
totalCount
IntA count of the total number of items in this connection, ignoring pagination.
#### DiscogsReleaseEdge
An edge in a Discogs release connection.
Field
Argument
Type
Descriptionnode
DiscogsRelease!The release at the end of the edge.
#### DiscogsUser
A user on Discogs.
Field
Argument
Type
Descriptionusername
String!The user’s username on Discogs.
#### DiscogsVideo
A single video linked from Discogs.
Field
Argument
Type
Descriptionurl
URLString!The URL of the video.
title
StringThe title of the video.
description
StringThe video description.
duration
DurationThe duration of the video in milliseconds.
embed
BooleanWhether the video is embeddable.
#### Label
:small_blue_diamond: *This type has been extended.
See the [base schema](https://github.com/exogen/graphbrainz/docs/types.md) for a description and additional fields.*Field
Argument
Type
Descriptiondiscogs
DiscogsLabelInformation about the label on Discogs.
#### Release
:small_blue_diamond: *This type has been extended.
See the [base schema](https://github.com/exogen/graphbrainz/docs/types.md) for a description and additional fields.*Field
Argument
Type
Descriptiondiscogs
DiscogsReleaseInformation about the release on Discogs.
#### ReleaseGroup
:small_blue_diamond: *This type has been extended.
See the [base schema](https://github.com/exogen/graphbrainz/docs/types.md) for a description and additional fields.*Field
Argument
Type
Descriptiondiscogs
DiscogsMasterInformation about the release group on Discogs.
### Enums
#### DiscogsImageType
The type of image.
Value
DescriptionPRIMARY
The primary image representing the item.
SECONDARY
A secondary image representing the item.
[demo]: http://graphbrainz-extension-discogs.herokuapp.com/