Project

tiny_song

0.0
No commit activity in last 3 years
No release in over 3 years
A TinySong Ruby library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.6.0

Runtime

>= 0
 Project Readme

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", ... }
]