Skip to content

grooveshark/tiny_song

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinySong Ruby Library

TinySong is a quick way to share songs through Facebook, Twitter, email or just about anywhere. Think of it as a TinyURL for songs. Powered by Grooveshark.

There are three basic methods when dealing with the library:

  • Grooveshark::TinySong#first - Returns a URL string for the first result (like Google’s “I’m Feeling Lucky”).

  • Grooveshark::TinySong#meta - Returns a hash of meta information about the first song found.

  • Grooveshark::TinySong#search - Perform a search, returning an array of result hashes.

All methods require an API key as the first argument. You can request an API key here: tinysong.com/api.

Usage

In a nutshell:

require 'grooveshark/tiny_song'

# Required to use the service.
api_key = 'YOUR_TINYSONG_API_KEY'

TinySong.first(api_key, 'Bad Brains')
# => "http://tinysong.com/2Z5Q"

TinySong.meta(api_key, 'Bad Brains')
# => {
  "Url" => "http://tinysong.com/2Z5Q",
  "SongID" => 8417130,
  "SongName" => "Banned in D.C.",
  "ArtistID" => 3419,
  "ArtistName" => "Bad Brains",
  "AlbumID" => 255086,
  "AlbumName" => "Bad Brains"
}

# Can pass an optional limit as the 2nd arg; default limit is 5, max is (currently) 32.
TinySong.search(api_key, 'Bad Brains', 3)
# => [
  { "Url" => "http://tinysong.com/2Z5Q", ... },
  { "Url" => "http://tinysong.com/gRqG", ... },
  { "Url" => "http://tinysong.com/1vPh", ... }
]

Packages

No packages published

Languages

  • JavaScript 64.2%
  • Ruby 35.8%