Need help with pygn?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

132 Stars 39 Forks MIT License 32 Commits 4 Opened issues


A simple Python client for the Gracenote Music API

Services available


Need anything else?

Contributors list

# 441,961
15 commits
# 221,816
3 commits
# 685,804
1 commit
# 681,549
1 commit
# 635,942
1 commit


pygn (pronounced "pigeon") is a simple Python client for the Gracenote Music API, which can retrieve Artist, Album and Track metadata with the most common options.

pygn allows you to look up artists, albums, and tracks in the Gracenote database, and returns a number of metadata fields, including:

  • Basic metadata like Artist Name, Album Title, Track Title
  • Descriptors like Genre, Origin, Mood, Tempo
  • Related content like Album Art, Artist Image, Biographies
  • Creating a radio playlist up to 25 titles based on track, artist, mood, era and genre
  • Trigger events in the radio playlist as track played , track skipped, track_like/dislike


Since pygn is (so far) contained in a single Python file, no installer is provided. Simply copy to your working directory, or to your Python site-packages/dist-packages directory, and call

import pygn

Getting Started

You will need a Gracenote Client ID to use this module. Please visit to get yours.

Each installed application also needs to have a User ID, which may be obtained by registering your Client ID with the Gracenote API. To do this, do:

import pygn

clientID = '***-****' # Enter your Client ID here userID = pygn.register(clientID)

This registration should be done only once per application to avoid hitting your API quota (i.e. definitely do NOT do this before every query). The userID can be stored in persistent storage (e.g. on the filesystem) and used for all subsequent pygn function calls.

Once you have your Client ID and User ID, you can start making queries.

To search for the Kings of Convenience track "Homesick" from their album "Riot On An Empty Street", do:

metadata =, userID=userID, artist='Kings Of Convenience', album='Riot On An Empty Street', track='Homesick')

The returned gnmetadata object is a Python dict containing multiple metadata fields.

    "album_art_url": "", 
    "album_artist_name": "Kings Of Convenience", 
    "album_gnid": "59247312-2ED193587EF0504C7A0C416ED66DA962", 
    "album_title": "Riot On An Empty Street", 
    "album_year": "2004", 
    "artist_bio_url": "", 
    "artist_era": {
        "1": {
            "ID": "29483", 
            "TEXT": "2000's"
    "artist_image_url": "", 
    "artist_origin": {
        "1": {
            "ID": "29896", 
            "TEXT": "Scandinavia"
        "2": {
            "ID": "29990", 
            "TEXT": "Norway"
    "artist_type": {
        "1": {
            "ID": "29422", 
            "TEXT": "Male"
        "2": {
            "ID": "29432", 
            "TEXT": "Male Duo"
    "genre": {
        "1": {
            "ID": "25312", 
            "TEXT": "Alternative & Punk"
        "2": {
            "ID": "35477", 
            "TEXT": "Indie Rock"
        "3": {
            "ID": "25460", 
            "TEXT": "Indie Pop"
    "mood": {
        "1": {
            "ID": "42949", 
            "TEXT": "Melancholy"
        "2": {
            "ID": "65343", 
            "TEXT": "Light Melancholy"
    "review_url": "", 
    "tempo": {
        "1": {
            "ID": "34283", 
            "TEXT": "Medium Tempo"
        "2": {
            "ID": "34289", 
            "TEXT": "Medium Slow"
        "3": {
            "ID": "34311", 
            "TEXT": "60s"
    "track_artist_name": "", 
    "track_gnid": "59247313-E198021B46C38679362C35619E93396B", 
    "track_number": "1", 
    "track_title": "Homesick"

Note that URLs to related content (e.g. Album Art, Artist Image, etc) are not valid forever, so your application should download the content you want relatively soon after the lookup and cache it locally.

The search function requires a clientID, userID, and at least one of either artist, album, or track to be specified.

For example, you can do

metadata =, userID=userID, artist='CSS')

which will return the same gnmetadata object with metadata for the top album by CSS (which happens to be 'Cansei De Ser Sexy' at time of writing), with track-specific fields being blank


metadata =, userID=userID, artist='Jaga Jazzist', album='What We Must')

will return a gnmetadata object with metadata for Jaga Jazzist's "What We Must" album, again with track-specific fields empty.

Rhythm API

The Rhythm API generates a playlist based on a song, an artist, a genre, a mood, an era or any combination of these inputs.

A radio is set up as follows:

createRadio(clientID='', userID='', artist='', track='', mood='', era='', genre='', popularity ='', similarity = '', count='10')

Parameter | Description ------------|-----------

|the track artist.
|the title of the song.
|a mood ID from the moods below.
|an era ID from the eras below.
|a genre ID from the genres below.
| The popularity threshold of the song, 0 means any popularity, 1000 means only the most popular songs.  
| How similar should the playlist be to the seed. This parameter determines how narrow the playlist is.
    |Number of songs in the intially created playlist, specify any number between 2 and 25 to generate a playlist




| track marked as played. Moves the play queue (drops track being played and adds additional track to end of queue).
| track marked as skipped. Moves the play queue.
| track marked as liked. Does not move the play queue.
| track marked as disliked. Refreshes the playlist queue.
| artist marked as liked. Does not move the play queue.
| artist marked as disliked. Refreshes the playlist queue.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.