Cover Art
A tiny client for the Cover Art Archive web service.
It works great with the Musicbrainz clien.
Ruby Version
Ruby version 1.9.0+ required.
Installation
Is this really necessary to explain ?
gem install coverart
Usage
Read the JSON API manual
require 'coverart'
api = CoverArt::Client.new
api.get '/release/76df3287-6cda-33eb-8e9a-044b5e15ffdd'
You can also use shortcuts :
# Get the front image URL
api.front '76df3287-6cda-33eb-8e9a-044b5e15ffdd'
# Get the back image URL
api.back '99b09d02-9cc9-3fed-8431-f162165a9371'
# Get the front image URL for a release group
api.group '76df3287-6cda-33eb-8e9a-044b5e15ffdd'
Caching & middlewares
In order to perform caching, you can use faraday_middleware or your own middlewares:
# Please note that faraday_middleware and active_support are not included as dependencies
# you may install them
require 'coverart'
require 'faraday_middleware'
require 'active_support'
api = CoverArt::Client.new do |f|
f.response :caching do
ActiveSupport::Cache.lookup_store :file_store, './tmp/cache', namespace: 'covertart', expires_in: 3600
end
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
