Coverart
A tiny client for the Cover Art Archive web service.
It works great with the Musicbrainz client.
Installation
bundle add coverart
Usage
You should first read the JSON API manual by Musicbrainz.
require "coverart"
client = Coverart::Client.new
client.get("/release/76df3287-6cda-33eb-8e9a-044b5e15ffdd")
You can also use shortcuts :
# Get the front image URL
client.front("76df3287-6cda-33eb-8e9a-044b5e15ffdd")
# Get the back image URL
client.back("99b09d02-9cc9-3fed-8431-f162165a9371")
# Get the front image URL for a release group
client.group("76df3287-6cda-33eb-8e9a-044b5e15ffdd")
Caching & middlewares
In order to perform caching, you can use faraday_middleware or your own middlewares:
# FYI: faraday_middleware and active_support are not present in dependencies.
# Add them to your bundle.
require "coverart"
require "faraday_middleware"
require "active_support"
client = Coverart::Client.new do |connection|
connection.response :caching do
ActiveSupport::Cache.lookup_store(:file_store, "./tmp/cache", namespace: "covertart", expires_in: 3600)
end
end
Contributing
- Don't hesitate to submit your feature/idea/fix in issues
- Fork the repository
- Create your feature branch
- Ensure RSpec & Rubocop are passing
- Create a pull request
Tests & lint
bundle exec rspec
bundle exec rubocop
Both can be run with:
bundle exec rake
License & credits
Please see LICENSE for further details.
Contributors: ./graphs/contributors