| Title: | Tidy Data from the 'Discogs' API |
|---|---|
| Description: | Sends requests to the 'Discogs' application programming interface (API) <https://www.discogs.com/developers> and returns the results as tidy tibbles. The 'Discogs' database can be searched, and releases, master releases, artists and labels can be read from it, along with the releases of an artist or label and the versions of a master release. The collection folders, collection and wantlist of a user can be listed, tallied and plotted, and marketplace statistics, price suggestions and collection values can be read. Tracklists, credits, formats, identifiers and companies of releases can be unnested into one row per item. Requests can be made with a personal access token or without one. They stay within the rate limit of the API and are retried when the limit is exceeded. Responses can be cached for the session, and paginated results can be fetched in full. |
| Authors: | Massimiliano Canzi [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-6124-0321>) |
| Maintainer: | Massimiliano Canzi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-11-20 21:27:50 UTC |
| Source: | https://github.com/mcanzi/tidycrates |
Gets artists from the 'Discogs' database. Names that several artists
share are told apart by a number in brackets, for example
"Persuader (2)".
dig_artist(id)dig_artist(id)
id |
One or more artist IDs, as numbers or as codes copied from
'Discogs' such as |
Profiles keep the 'Discogs' markup for links, such as [a=Carl Craig].
Images are left out, because the people who upload them can hold their
own copyright. dig_artist_releases() lists the releases of an artist.
A tibble with one row per artist, or NULL invisibly if the API
cannot be reached. The columns are artist_id, name, real_name,
profile, data_quality, uri, urls and name_variations as list
columns of character vectors, and aliases, members and groups as
list columns of tibbles.
dig_artist(1)dig_artist(1)
Lists the releases and master releases an artist appears on, with the role of the artist on each.
dig_artist_releases( id, sort = c("year", "title", "format"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )dig_artist_releases( id, sort = c("year", "title", "format"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )
id |
An artist ID, as a number or as a code copied from 'Discogs'
such as |
sort |
The column to sort by: |
order |
The sort order: |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
'Discogs' returns up to 100 items per page and sometimes fewer than
per_page. With all = TRUE, every page is fetched, which takes one
request for each 100 items. If this takes a minute or more, a message
gives the least time it takes.
A tibble with one row per release or master release, or NULL
invisibly if the API cannot be reached. type tells releases and
master releases apart, and id is the ID of either. have and want
are the numbers of users with the item in their collection or
wantlist.
dig_artist_releases(1, all = TRUE)dig_artist_releases(1, all = TRUE)
Sets the personal access token used for requests in this session. With a
token, 'Discogs' allows 60 requests a minute instead of 25,
dig_collection() and dig_wantlist() can read your own collection and
wantlist when they are private, and dig_search(),
dig_price_suggestions() and dig_collection_value() work. A token
can be generated at https://www.discogs.com/settings/developers.
dig_auth(token = Sys.getenv("DISCOGS_TOKEN"))dig_auth(token = Sys.getenv("DISCOGS_TOKEN"))
token |
A personal access token. By default the value of the
|
If dig_auth() is never called, the DISCOGS_TOKEN environment
variable is used. Storing the token in .Renviron keeps it out of your
scripts.
TRUE if a token is set and FALSE otherwise, invisibly.
dig_auth()dig_auth()
Removes the responses that were cached because the option
tidycrates.cache is TRUE, and the username found for the token by
functions such as dig_collection(). The next requests are sent to
'Discogs' again.
dig_cache_clear()dig_cache_clear()
NULL, invisibly.
dig_cache_clear()dig_cache_clear()
Lists the releases in the collection of a 'Discogs' user. Anyone can
read a public collection. A private collection can only be read with
the token of its owner, see dig_auth(). Without a username, the
collection of the token owner is listed.
dig_collection( username = NULL, folder = 0, sort = c("added", "artist", "title", "label", "catno", "format", "rating", "year"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )dig_collection( username = NULL, folder = 0, sort = c("added", "artist", "title", "label", "catno", "format", "rating", "year"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )
username |
A 'Discogs' username, or |
folder |
The ID of a collection folder, see
|
sort |
The column to sort by: |
order |
The sort order: |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
A release that is in the collection more than once has one row per
copy, each with its own instance_id. Collections are never cached, so
changes show up at once.
The media and sleeve conditions come from the collection fields named
Media and Sleeve. If any copy has a value in a field, the fields are
matched by name with one more request. Other fields, such as Notes, are
left out. Without the token of the owner, only public fields can be
read, and the conditions are NA for fields that are private. If the
fields cannot be read, a message says so and the conditions are NA.
The folder names are read with one more request, as in
dig_collection_folders(). Other users can only see folder 0, so the
names of other folders are NA without the token of the owner. The
request is skipped without a token, and when the token owner is known
from an earlier call to be someone else. If the folders cannot be read,
a message says so and the names are NA.
A tibble with one row per copy of a release, or NULL
invisibly if the API cannot be reached. The columns are release_id,
instance_id, folder_id, folder, title, artist, year,
label, catno, format, media_condition, sleeve_condition,
genres and styles as list columns, master_id, rating and
date_added. rating is NA if the user gave none. The conditions
are factors from best to worst, with the same grades as
dig_price_suggestions(). The sleeve condition can also be
"Generic" or "No Cover", and a condition is NA if the user gave
none.
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
collection <- dig_collection("username", all = TRUE) dplyr::count(collection, format, sort = TRUE) dplyr::count(collection, media_condition) dplyr::count(collection, folder)collection <- dig_collection("username", all = TRUE) dplyr::count(collection, format, sort = TRUE) dplyr::count(collection, media_condition) dplyr::count(collection, folder)
Lists the folders of a 'Discogs' collection, with the number of
releases in each. Folder 0 holds the whole collection and folder 1
holds the releases that are in no other folder. Other users can only
see folder 0, unless the collection is read with the token of its
owner, see dig_auth(). Folders are never cached. dig_collection()
adds the folder name of each copy itself.
dig_collection_folders(username = NULL)dig_collection_folders(username = NULL)
username |
A 'Discogs' username, or |
A tibble with one row per folder and the columns folder_id,
name and count, or NULL invisibly if the API cannot be reached.
folder_id can be passed to dig_collection().
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
dig_collection_folders("username")dig_collection_folders("username")
Gets the minimum, median and maximum value of a collection, as
'Discogs' estimates it from marketplace sales. Only the owner of a
collection can get its value, so this needs the owner's token, see
dig_auth(). Without a username, the value of the token owner's
collection is read.
dig_collection_value(username = NULL)dig_collection_value(username = NULL)
username |
A 'Discogs' username, or |
'Discogs' returns the values as formatted text, such as "$1,250.00".
They are turned into numbers, and the currency symbol is kept in
currency. The value is never cached.
A tibble with one row and the columns username, minimum,
median, maximum and currency, or NULL invisibly if the API
cannot be reached. A value that cannot be read is NA.
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
dig_collection_value()dig_collection_value()
Gets record labels and other companies, such as pressing plants and studios, from the 'Discogs' database.
dig_label(id)dig_label(id)
id |
One or more label IDs, as numbers or as codes copied from
'Discogs' such as |
Profiles keep the 'Discogs' markup for links. Images are left out,
because the people who upload them can hold their own copyright.
dig_label_releases() lists the releases of a label.
A tibble with one row per label, or NULL invisibly if the API
cannot be reached. The columns are label_id, name, profile,
contact_info, parent_label, parent_label_id, data_quality,
uri, urls as a list column of character vectors, and sublabels
as a list column of tibbles.
dig_label(1)dig_label(1)
Lists the releases of a label or other company.
dig_label_releases(id, all = FALSE, page = 1, per_page = 50)dig_label_releases(id, all = FALSE, page = 1, per_page = 50)
id |
A label ID, as a number or as a code copied from 'Discogs'
such as |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
A tibble with one row per release, or NULL invisibly if the API
cannot be reached.
dig_label_releases(1)dig_label_releases(1)
Gets master releases from the 'Discogs' database. A master release groups all versions of a release, such as the original pressing, later reissues and editions in other countries.
dig_master(id)dig_master(id)
id |
One or more master release IDs, as numbers or as codes copied
from 'Discogs' such as |
Images are left out, because the people who upload them can hold their
own copyright. dig_master_versions() lists the versions.
A tibble with one row per master release, or NULL invisibly if
the API cannot be reached. The columns are master_id, title,
artist, year, genres, styles, main_release,
most_recent_release, data_quality, uri and tracklist, a list
column of tibbles that dig_tracklist() unnests.
dig_master(96559)dig_master(96559)
Lists the releases that belong to a master release, such as reissues and editions in other countries. The versions can be filtered by format, label, year and country.
dig_master_versions( id, format = NULL, label = NULL, released = NULL, country = NULL, sort = c("released", "title", "format", "label", "catno", "country"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )dig_master_versions( id, format = NULL, label = NULL, released = NULL, country = NULL, sort = c("released", "title", "format", "label", "catno", "country"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )
id |
A master release ID, as a number or as a code copied from
'Discogs' such as |
format, label, released, country
|
Values to filter the versions by,
for example |
sort |
The column to sort by: |
order |
The sort order: |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
A tibble with one row per version, or NULL invisibly if the API
cannot be reached. have and want are the numbers of users with the
version in their collection or wantlist.
dig_master_versions(1000, format = "CD")dig_master_versions(1000, format = "CD")
Plots the counts from dig_tally() with a title, a subtitle that says
what is shown, and alt text for screen readers. Genres, styles,
formats, labels, artists, roles and countries are drawn as ranked
lollipops with the count and share at each tip. Decades are columns
with their counts, years are columns with the busiest year marked, and
by = "added" is a line of the running total. Plotting needs the
ggplot2 package.
dig_plot( x, by = c("genre", "style", "format", "label", "artist", "role", "country", "decade", "year", "added"), n = 10, unique = FALSE )dig_plot( x, by = c("genre", "style", "format", "label", "artist", "role", "country", "decade", "year", "added"), n = 10, unique = FALSE )
x |
A tibble returned by one of the functions listed in Details. |
by |
What to count by: |
n |
The number of values to keep for all but years, decades and
months. The rest are counted together as |
unique |
If |
The colours have a contrast of at least 3:1 with the background, and
every value that is not on an axis is written next to its mark, so no
value depends on colour alone. The title, subtitle and alt text can be
changed with ggplot2::labs().
Every plot has the caption "Data provided by Discogs.", which the API
Terms of Use require next to any data from 'Discogs'. Where you publish
a plot, link the caption to the 'Discogs' page with the data. Plots of
a collection or wantlist show Restricted Data, see dig_collection().
A ggplot object, which can be changed with +, or NULL
invisibly if x is NULL.
shelf <- tibble::tibble( release_id = c(1, 1, 2, 3), year = c(1994, 1994, 1998, NA), genres = list(c("Electronic", "Pop"), c("Electronic", "Pop"), "Electronic", "Jazz") ) dig_plot(shelf, "genre") dig_plot(shelf, "year") collection <- dig_collection("username", all = TRUE) dig_plot(collection, "decade") dig_plot(collection, "added") dig_plot(dig_artist_releases(1, all = TRUE), "role")shelf <- tibble::tibble( release_id = c(1, 1, 2, 3), year = c(1994, 1994, 1998, NA), genres = list(c("Electronic", "Pop"), c("Electronic", "Pop"), "Electronic", "Jazz") ) dig_plot(shelf, "genre") dig_plot(shelf, "year") collection <- dig_collection("username", all = TRUE) dig_plot(collection, "decade") dig_plot(collection, "added") dig_plot(dig_artist_releases(1, all = TRUE), "role")
Gets the lowest price and the number of copies for sale of releases in the 'Discogs' marketplace. A token is not needed.
dig_price_stats(id, currency = NULL)dig_price_stats(id, currency = NULL)
id |
One or more release IDs, as numbers or as codes copied from
'Discogs' such as |
currency |
The currency of the prices, one of |
Prices change quickly, so these requests are never cached. Without a
token and without currency, prices are in US dollars. With a token,
they are in the buyer currency of your account.
A tibble with one row per release, or NULL invisibly if the API
cannot be reached. The columns are release_id, lowest_price,
currency, for_sale, the number of copies for sale, and blocked,
which is TRUE if the release may not be sold. lowest_price and
currency are NA if no copy is for sale, and for_sale is NA if
the release is blocked.
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
dig_price_stats(249504, currency = "EUR")dig_price_stats(249504, currency = "EUR")
Gets the prices 'Discogs' suggests for releases in each condition, from
Mint to Poor. Price suggestions need a token, see dig_auth(), and the
seller settings of the account must be filled in on 'Discogs'.
dig_price_suggestions(id)dig_price_suggestions(id)
id |
One or more release IDs, as numbers or as codes copied from
'Discogs' such as |
The prices are in the selling currency of your account. They are never cached, because they change quickly.
A tibble with one row per release and condition, or NULL
invisibly if the API cannot be reached. The columns are release_id,
condition, a factor from best to worst, price and currency. A
release without suggestions has no rows.
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
dig_price_suggestions(249504)dig_price_suggestions(249504)
Asks 'Discogs' how many requests are left in the current window. The check is a request itself and counts towards the limit.
dig_rate_limit()dig_rate_limit()
'Discogs' allows 60 requests a minute with a token and 25 without. Its documentation describes a moving average over a 60 second window. In tests made for tidycrates, the count followed clock minutes and was
current + previous * (1 - seconds / 60)
where current is the number of requests so far in this clock minute,
previous the number in the minute before, and seconds the time since
this minute began. Requests of one minute therefore fade out over the
next, and a burst counts for up to two minutes. Refused requests were
counted too.
tidycrates keeps the same count of its own requests. A request is sent at once while the count is 58 or less with a token, or 23 or less without, so up to 59 or 24 requests go out in a minute. Later requests wait until the count has room again, and no longer. If the response headers give another limit, the count may reach two below it. If 'Discogs' reports a higher count, for example because other applications use the same token, the difference is added. Requests are retried after HTTP 429 and 503 responses. A message says how long each wait of a second or more takes; when several items are fetched, the progress bar counts the wait down instead and its ETA includes the waits still to come. The limit only needs checking when other applications share the same token or IP address.
The count uses the clock of your computer. A clock that is off by a second changes it by about one request, which the margin of two covers. A larger error can lead to refused requests until the count reported by 'Discogs' corrects it.
A tibble with one row and the columns limit, used,
remaining and authenticated, or NULL invisibly if the API cannot
be reached.
httr2 has a throttle of its own, httr2::req_throttle(), but it cannot
follow the count of 'Discogs'. Its bucket allows a burst and then
refills at a steady rate, and it does not know that a burst counts for
up to two minutes. A bucket that allows a full minute of requests at
once sends more requests than 'Discogs' allows. They are refused, still
counted, and retried after waits of 10 seconds or more, so long batches
slow down and can fail. A bucket small enough to stay within the limit
either spaces all requests evenly, so every small batch waits about a
second for each request, or refills more slowly, so long batches take
up to twice as long.
Keeping the same count as 'Discogs' avoids both problems. Requests go out at once whenever 'Discogs' has room, wait only as long as needed when it has none, and are not refused. In a simulation with 0.4 seconds for each request, 46 requests took about 18 seconds this way and about 46 seconds with even spacing, and 300 requests took about as long with both.
dig_rate_limit()dig_rate_limit()
Gets releases from the 'Discogs' database. A release is one particular edition of a recording, such as the 1987 UK 7" single of a song.
dig_release(id)dig_release(id)
id |
One or more release IDs, as numbers or as codes copied from
'Discogs' such as |
The tracklist, credits, formats, identifiers and companies are kept as
list columns of tibbles. dig_tracklist(), dig_credits(),
dig_formats(), dig_identifiers() and dig_companies() turn them
into one row per item.
Images are left out, because the people who upload them can hold their
own copyright. Prices are left out too, because they change quickly and
this function can be cached. dig_price_stats() gets them. The uri
column links to the release on the 'Discogs' website.
A tibble with one row per release, or NULL invisibly if the
API cannot be reached. Several labels, catalogue numbers or formats are
separated by semicolons in label, catno and format. genres and
styles are list columns of character vectors. have and want give
the number of users with the release in their collection or wantlist.
The tracklist, credits, formats, identifiers and companies are list
columns of tibbles.
dig_master() and dig_master_versions() for other versions of
a release.
dig_release(249504)dig_release(249504)
Searches the releases, master releases, artists and labels in the
'Discogs' database. Search needs a token, see dig_auth(), but the token
can belong to any user.
dig_search( query = NULL, type = NULL, title = NULL, release_title = NULL, credit = NULL, artist = NULL, anv = NULL, label = NULL, genre = NULL, style = NULL, country = NULL, year = NULL, format = NULL, catno = NULL, barcode = NULL, track = NULL, sort = c("score", "title", "have", "want", "hot", "date_added", "date_changed", "year"), order = c("desc", "asc"), all = FALSE, page = 1, per_page = 50 )dig_search( query = NULL, type = NULL, title = NULL, release_title = NULL, credit = NULL, artist = NULL, anv = NULL, label = NULL, genre = NULL, style = NULL, country = NULL, year = NULL, format = NULL, catno = NULL, barcode = NULL, track = NULL, sort = c("score", "title", "have", "want", "hot", "date_added", "date_changed", "year"), order = c("desc", "asc"), all = FALSE, page = 1, per_page = 50 )
query |
The search query, or |
type |
The type of result: |
title |
The combined title, as in |
release_title |
The title of the release. |
credit |
A name in the credits. |
artist |
The name of the artist. |
anv |
The name the artist is credited as on the release. |
label, genre, style, country, year, format, catno, barcode
|
Values to
filter the results by, for example |
track |
The title of a track. |
sort |
The column to sort by: |
order |
The sort order: |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
Give a search query, one or more filters, or both. Each filter searches
one field, so artist = "Juniper Static" finds releases by that artist
but not releases that only mention the name in their title. The IDs in
id can be passed to dig_release(), dig_master(), dig_artist() or
dig_label(), depending on type.
'Discogs' returns up to 100 results per page. With all = TRUE, every
page is fetched, which takes one request for each 100 results. A search
with more than 100 pages, or 10,000 results, stops with an error before
the other pages are fetched, so that a broad search does not send
hundreds of requests. Single pages can still be fetched with page.
A tibble with one row per result, or NULL invisibly if the API
cannot be reached. type tells releases, master releases, artists and
labels apart, and id is the ID of either. title combines the artist
and the title, and for artists and labels it is the name. genres and
styles are list columns. have and want are the numbers of users
with the item in their collection or wantlist. Columns that do not
apply to a type, such as catno for artists, are NA.
dig_search("Lantern Weather", type = "release") dig_search(artist = "Juniper Static", format = "Vinyl", year = 1994)dig_search("Lantern Weather", type = "release") dig_search(artist = "Juniper Static", format = "Vinyl", year = 1994)
Counts the rows of a tibble returned by tidycrates, such as the copies
in a collection or the releases of a label, by genre, style, format,
label, artist, role, country, year, decade or month added. Only the
columns of x are used, so no requests are sent.
dig_tally( x, by = c("genre", "style", "format", "label", "artist", "role", "country", "decade", "year", "added"), n = 10, unique = FALSE )dig_tally( x, by = c("genre", "style", "format", "label", "artist", "role", "country", "decade", "year", "added"), n = 10, unique = FALSE )
x |
A tibble returned by one of the functions listed in Details. |
by |
What to count by: |
n |
The number of values to keep for all but years, decades and
months. The rest are counted together as |
unique |
If |
Which values of by work depends on where x comes from:
x from |
by |
dig_collection(), dig_wantlist() |
genre, style, format, label, artist, decade, year, added |
dig_release() |
genre, style, format, label, artist, country, decade, year, added |
dig_master() |
genre, style, artist, decade, year |
dig_artist_releases() |
format, label, artist, role, decade, year |
dig_label_releases() |
format, artist, decade, year |
dig_master_versions() |
format, label, country, decade, year |
dig_search() |
genre, style, format, label, country, decade, year |
A row with several genres, styles, formats or labels counts once for each of them, so the shares can add up to more than 1. Rows without a value, such as releases with an unknown year, are left out.
The lists of dig_artist_releases() and dig_label_releases() give
formats as descriptions such as 2x12", Comp. Only the first part is
counted, without the number of items, so vinyl is counted by size, for
example 12". dig_search() gives the format of a release followed by
its descriptions, and only the format is counted. Master releases in
dig_artist_releases() stand for all their versions and have no format
or label. For dig_release(), added is the month the release was
added to 'Discogs'.
Collections and wantlists have no country, because 'Discogs' does not
return it for them. To tally a collection by country, get its releases
first with dig_release(collection$release_id). This sends one request
for each release.
Tallies of a collection or wantlist are still Restricted Data, see
dig_collection().
A tibble with a column named after by, n, the number of
rows, and share, the share of all rows. For by = "added", total
gives the running number of rows at the end of each month, such as the
size of a collection. Years, decades and months are in order, and
other values are sorted from most to least common. "Other" counts
the rows with at least one value outside the top n. It is called
"All other" if one of the values is "Other". NULL is returned
invisibly if x is NULL.
shelf <- tibble::tibble( release_id = c(1, 1, 2, 3), year = c(1994, 1994, 1998, NA), genres = list(c("Electronic", "Pop"), c("Electronic", "Pop"), "Electronic", "Jazz") ) dig_tally(shelf, "genre") dig_tally(shelf, "decade") dig_tally(shelf, "genre", unique = TRUE) collection <- dig_collection("username", all = TRUE) dig_tally(collection, "genre") dig_tally(collection, "added") dig_tally(dig_label_releases(1, all = TRUE), "decade")shelf <- tibble::tibble( release_id = c(1, 1, 2, 3), year = c(1994, 1994, 1998, NA), genres = list(c("Electronic", "Pop"), c("Electronic", "Pop"), "Electronic", "Jazz") ) dig_tally(shelf, "genre") dig_tally(shelf, "decade") dig_tally(shelf, "genre", unique = TRUE) collection <- dig_collection("username", all = TRUE) dig_tally(collection, "genre") dig_tally(collection, "added") dig_tally(dig_label_releases(1, all = TRUE), "decade")
'Discogs' asks every application to identify itself with a user agent.
Requests are sent as tidycrates/<version> (+https://github.com/mcanzi/tidycrates) by default. A name set here is
placed in front, so requests from your script or application can be told
apart.
dig_user_agent(agent = NULL)dig_user_agent(agent = NULL)
agent |
The name and version of your application, for example
|
The user agent, invisibly if agent is given.
dig_user_agent()dig_user_agent()
Lists the releases in the wantlist of a 'Discogs' user. Anyone can read
a public wantlist. A private wantlist can only be read with the token of
its owner, see dig_auth(). Without a username, the wantlist of the
token owner is listed. Wantlists are never cached, so changes show up
at once.
dig_wantlist( username = NULL, sort = c("added", "artist", "title", "label", "catno", "format", "rating", "year"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )dig_wantlist( username = NULL, sort = c("added", "artist", "title", "label", "catno", "format", "rating", "year"), order = c("asc", "desc"), all = FALSE, page = 1, per_page = 50 )
username |
A 'Discogs' username, or |
sort |
The column to sort by: |
order |
The sort order: |
all |
If |
page |
The page to fetch. |
per_page |
The number of items per page, from 1 to 100. |
The notes that a user writes for each release are left out, because they can be personal.
A tibble with one row per release, or NULL invisibly if the
API cannot be reached. The columns are release_id, title,
artist, year, label, catno, format, genres and styles as
list columns, master_id, rating and date_added. rating is NA
if the user gave none.
Collections, wantlists, usernames and marketplace data, such as prices and collection values, are Restricted Data under the 'Discogs' API Terms of Use. 'Discogs' grants each user a limited, personal licence to access and use them with their own token. They may not be passed on to anyone else or used for commercial purposes, and their use must respect the privacy of their owners. Keep them, and tallies and plots of them, for your own use, and do not publish them. The Terms of Use also forbid using the API to get around the 'Discogs' marketplace.
dig_wantlist("username", all = TRUE)dig_wantlist("username", all = TRUE)
Turns the list columns of dig_release() into tibbles with one row per
track, credit, format, identifier or company. Each row keeps the ID of
its release.
dig_tracklist(x) dig_credits(x) dig_formats(x) dig_identifiers(x) dig_companies(x)dig_tracklist(x) dig_credits(x) dig_formats(x) dig_identifiers(x) dig_companies(x)
x |
A tibble returned by |
dig_tracklist() also accepts the output of dig_master(). Headings
and index tracks are kept with their type, and the tracks of an index
follow it. seconds is the duration converted to seconds.
dig_credits() combines the credits of the whole release with those of
single tracks. credited_as is the name printed on the release, if it
differs from the artist name, and tracks gives the positions a credit
applies to.
dig_companies() lists the labels of the release followed by the other
companies, such as pressing plants and studios. role says what each
company did, and label_id can be passed to dig_label().
A tibble, or NULL invisibly if the API cannot be reached.
release <- dig_release(249504) dig_tracklist(release) dig_credits(release) dig_formats(release) dig_identifiers(release) dig_companies(release)release <- dig_release(249504) dig_tracklist(release) dig_credits(release) dig_formats(release) dig_identifiers(release) dig_companies(release)