Postrocktues
Postrocktu.es is a fantastic site for getting inspiration for new postrock artists and tracks.
I use it every tuesday(when new tracks are released) so I build this gem to get Spotify links from the tracks. Oh how awesome! Do you know what's even more awesome?! Creating a gorgeous Postrock playlist out of this, oh yeah
Installation
Add this line to your application's Gemfile:
gem 'postrocktues'
And then execute:
$ bundle
Or install it yourself as:
$ gem install postrocktues
Usage
Setup
First of all, you need a Spotify premium account, if you don't have one pay up and get one! You'll thank me later!!
- Log into your account and get the appkey for this project to work. Consult the documentation here on how do do this.
- Place the
app_key.key
file in the root of this project - Enter your Spotify credentials into the
config.yml
file, there is an example provided. - Let's fire up irb/pry and get this working!
Some code examples!
require 'postrocktues'
feed = Postrocktues::Feed.new
tracks = feed.tracks
# This step unfortunatly takes a while..
# since it has to search for all of the tracks
track = tracks.last
track.name
#=> "Your Hand In Mine"
track.artist
#=> "Explosions in the Sky"
track.uri
#=> "spotify:track:2kZVhrdxG7BEIsyrTJYdq9"
track.url
#=> "http://open.spotify.com/track/2kZVhrdxG7BEIsyrTJYdq9"
Here's how you would create a playlist out of the tracks!
playlist = Postrocktues::Playlist.new
playlist.add tracks # tracks comes from the previous example
playlist.upload # uploads it to Spotify
Then just pop open Spotify and enjoy some glorious Postrock.
Note
Sadly, the whole creating tracks process is a bit slow. It currently takes ~30 seconds to load up all of the tracks. Since I first have to:
- Search for the tracks, remove tracks that can't be found
- Create track objects from the search result
It is a bit slow, but it's manageable! It will get faster, as soon as I figure out how..
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Don't forget the tests! I won't accept a PR without any tests, sorry
- Push to the branch (
git push origin my-new-feature
) - Create new Pull Request