Sha256: ac89d7db0f148d92f1175187e899321c52abad0572b73e2dc35f7eb548b27e5d

Contents?: true

Size: 1.68 KB

Versions: 6

Compression:

Stored size: 1.68 KB

Contents

# meta-spotify

A ruby wrapper for the Spotify Metadata API. See here for usage: http://developer.spotify.com/en/metadata-api/overview/

Use of the API is subject to the Terms and Conditions: http://developer.spotify.com/en/metadata-api/terms-of-use/

## Installation

    gem install meta-spotify

## Usage

The API has two services for the three types of data, artists, albums and tracks:

### Lookup

To look up an artist, album or track, simply call:

    MetaSpotify::Artist.lookup(spotify_uri)
    MetaSpotify::Album.lookup(spotify_uri)
or
    MetaSpotify::Track.lookup(spotify_uri)

e.g.

    artist = MetaSpotify::Artist.lookup("spotify:artist:4YrKBkKSVeqDamzBPWVnSJ")
    #=> #<MetaSpotify::Artist:0x119764c @name="Basement Jaxx">

    artist.name
    #=> "Basement Jaxx"

You can also call lookup with the extras parameter, but only the acceptable extras will yield results, e.g.

    artist = MetaSpotify::Artist.lookup('spotify:artist:4YrKBkKSVeqDamzBPWVnSJ', :extras => 'album')

    artist.albums.first.name
    #=> "Jaxx Unreleased"

### Search

To search for an artist, album or track works the same way as lookup, simply call:

    MetaSpotify::Artist.search(search_term)
    MetaSpotify::Album.search(search_term)
or
    MetaSpotify::Track.search(search_term)

e.g.

    search = MetaSpotify::Artist.search('foo')

    search.artists.first.name
    #=> "Foo fighters"

For searches with many results, the result also contains details on pages and you can return page 2 like this:

    MetaSpotify::Artist.search('foo', :page => 2)

## Disclaimer

This is very new, so please let me know of any problems or anything that is missing.

## Copyright

Copyright (c) 2009 Phil Nash. See LICENSE for details.

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
meta-spotify-0.1.6 README.markdown
meta-spotify-0.1.5 README.markdown
meta-spotify-0.1.4 README.markdown
meta-spotify-0.1.3 README.markdown
meta-spotify-0.1.2 README.markdown
meta-spotify-0.1.1 README.markdown