Skip to content
The brain of this phonetic symphony
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
db
dictionaries
lib
log
public
spec
vendor/assets
.gitignore
.rspec
.ruby-gemset
.ruby-version
Gemfile
Gemfile.lock
README.md
README.rdoc
Rakefile
bookduets_mockup.pdf
config.ru
musician_author_seed.csv
product_plan.md
redis.conf

README.md

Feed the Book Duets API author and musician names. Receive a Markov chain mashup of their written and spoken words.

Code Climate

Table of Contents

User-Facing App

See this API in action by visiting www.bookduets.com!

What Are Book Duets?

Book Duets are computer-generated mashups of lyrics and literary quotes. Learn more about the connections between well-known musicians and authors.

Did you know that Haruki Murakami is a fan of Radiohead? Or that Chuck Palahniuk listened to Nine Inch Nails while writing Fight Club? Learn more trivia like this by requesting a randomly-generated Suggested Pairing Book Duet that highlights these intriguing connections and mashes up their work.

Or try your luck at creating a custom Book Duet by plugging in a musician and author of your choice. You might end up with something weird, thrilling, deep, or just plain nonsensical.

Get an API Key

To use the Book Duets API, you'll need to register for an API key. (If you try to get Book Duets without an API key, then you'll get a 401 Unauthorized error.)

To register for a key:

 POST "api.bookduets.com/register?email="your@email.here" 

You should receive a response that looks like this:

 {"message":"Here is your unique API key.","api_key":"YOUR_SECRET_API_KEY"} 

Make sure to save this unique API key, since you will need it to retrieve Book Duets.

REST Endpoints

  • Authentication - Once you have a unique API key, you'll need to send it in each request header for authentication, formatted as:
 "Book-Duets-Key" => ENV['YOUR_SECRET_API_KEY'] 

Once your API key is in the request header, then you can hit the following endpoints.

  • Base URI:

    api.bookduets.com

  • GET a suggested pairing + a book duet:

     /suggested_pairing?filter_level=FILTER_LEVEL 

  • GET a custom book duet:

     /custom_duet?musician=MUSICIAN_NAME&author=AUTHOR_NAME&filter_level=FILTER_LEVEL 

Parameters

  • filter_level: This parameter is required for all lookups. Possible values include:

    • none: No filtering - may contain offensive or explicit language
    • med: Many curse words permitted, some offensive content is replaced with text bleeps (#@%!)
    • hi: Both offensive language and curse words replaced by text bleeps (#@%!)
  • musician: Names (as they appear on Musixmatch)

  • author: Names (as they appear on WikiQuotes)

Examples

Here are some amazing examples of some past computer-generated mashups:

  • /suggested_pairing?filter_level=hi

{"author": "Margaret Atwood", "musician": "Feist", "news_source": "http://flavorwire.com/384073/you-favorite-authors-favorite-musicians/4, "book_duet":"Gatekeeper, Gatekeeper seasons wait for your nod I feel it all. Oooh, I'll be the case now. Instead we are opposite, we touch as though attacking, the gifts we bring even in good faith maybe warp in our hands to implements, to maneuvers in restaurants we argue over which of..."}

  • /custom_duet?musician=Hanson&author=Stephenie_Meyer&filter_level=hi

{"author": "Stephenie Meyer", "musician": "Hanson", "book_duet":"I'll give you passionate, I muttered. I truly knew - knew it deep in my eyes as I thrilled to the word."}

Formatting Artist Names

The following formatting options are supported by the Book Duets endpoints

  • Spaces or Underscores (Crystal Castles, William_Gibson)
  • Special characters (Anaïs Nin, Möterhead)
  • Initials (S. E. Hinton or S._E._Hinton)

If you are having difficulty retrieving specific artists by name, check to see how they are formatted on Wikiquotes or Musixmatch. Book Duets relies on these APIs to build corpora for Markov dictionaries.

Project History

This was a part of my capstone project for Ada Developers Academy. As a music enthusiast and former freelance writer, I had quite a bit of fun blending my interests and putting this API together. I hope to expand on both the web app and the API in the future!

Mahalo to @jnf, @kariabancroft, and my cohort[2] unigoats for your invaluable instruction and support.

License

MIT License

Please feel free to submit suggestions or improvements via github to help make Book Duets even better!

You can’t perform that action at this time.