
Security News
ESLint Adds Support for Parallel Linting, Closing 10-Year-Old Feature Request
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
A Ruby implementation of the Spotify Meta API.
This gem is used internally at the Radiofy project.
Follow me on Twitter for more info and updates.
The Spot::Search.find_song
method returns the first hit.
Spot::Search.find_song("Like Glue")
The find_all_songs
method returns a list of Spot::Song
objects.
Spot::Search.find_all_songs("Like Glue")
The Spot::Search.find_artist
method returns the first hit.
Spot::Search.find_artist("Madonna")
The find_all_artists
method returns a list of Spot::Artist
objects.
Spot::Search.find_all_artists("Madonna")
The Spot::Search.find_album
method returns the first hit.
Spot::Search.find_album("Old Skool Of Rock")
The find_all_albums
method returns a list of Spot::Album
objects.
Spot::Search.find_all_albums("Old Skool Of Rock")
The prime
method makes it possible to fetch the best matching result based on the ingoing argument. It will reject data (songs, artists and albums) that contains any of the these words.
Spot::Search.prime.find_song("Sweet Home Alabama")
All songs in Spotify isn't available everywhere. It might therefore be usefull to specify a location, also know as a territory.
If you for example want to find all songs available in Sweden, then you might do something like this.
Spot::Search.territory("SE").find_song("Sweet Home Alabama")
You can find the complete territory list here.
Sometimes it may be useful to filer ingoing params.
You can filter the ingoing string by using the strip
method.
Spot::Search.strip.find_song("3. Who's That Chick ? feat.Rihanna [Singel Version] - (Single)")
This is the string that is being passed to Spot.
"who's that chick ?"
Spot::Search.page(11).find_song("sweet home")
You can easily chain method like this.
Spot::Search.page(11).territory("SE").prime.strip.find_song("sweet home")
As soon as the result
or results
method is applied to the query a request to Spotify is made.
Here is an example (#result
).
>> song = Spot::Search.find_song("sweet home").result
>> puts song.title
=> Home Sweet Home
>> puts song.class
=> Spot::Song
Here is an example (#results
).
>> songs = Spot::Search.find_all_songs("sweet home").results
>> puts songs.count
=> 100
Spot::Song
, Spot::Artist
and Spot::Album
shares the following methods.
0.0
to 1.0
.spotify:track:5DhDGwNXRPHsMApbtVKvFb
.
http
may be passed as a string, which will return an Spotify HTTP Url.Spot::Song#title
.Methods available for the Spot::Song
class.
Methods available for the Spot::Artist
class.
Methods available for the Spot::Album
class.
spot = Spot::Search.find_song("kaizers orchestra")
puts spot.num_results # => 188
puts spot.limit # => 100
puts spot.offset # => 0
puts spot.query # => "kaizers orchestra"
Be aware: Spotify has an request limit set for 10 requests per second.
Which means that you can't just use it like this.
["song1", "song2", ...].each do |song|
Spot::Search.find_song(song)
# Do something with the data.
end
Instead use something like Wire to limit the amount of requests per seconds.
require "rubygems"
require "wire"
require "spot"
wires = []
["song1", "song2" ... ].each do |s|
wires << Wire.new(max: 10, wait: 1, vars: [s]) do |song|
Spot::Search.find_song(song)
# Do something with the data.
end
end
wires.map(&:join)
[sudo] gem install spot
Spot is tested in OS X 10.6.7, 10.7.4 using Ruby 1.8.7, 1.9.2.
Spot is released under the MIT license.
FAQs
Unknown package
We found that spot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.