Created
May 9, 2013 03:41
-
-
Save BrianMMcClain/5545400 to your computer and use it in GitHub Desktop.
Example usage of the Hallon gem to login to Spotify, search for tracks and play a song
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hallon' | |
require 'hallon/openal' | |
session = Hallon::Session.initialize IO.read('./spotify_appkey.key') | |
session.login!('johndoe', 'superpassword') | |
search = Hallon::Search.new("Daft Punk Get Lucky") | |
search.load | |
tracks = search.tracks[0...5].map(&:load) | |
puts "Top 5 Results" | |
tracks.each do |track| | |
puts "#{track.artist.name} - #{track.name}" | |
end | |
player = Hallon::Player.new(Hallon::OpenAL) | |
player.play!(tracks.first) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment