Code Monkey home page Code Monkey logo

spotify-poem's Introduction

Inspired by http://spotifypoetry.tumblr.com, poem.py takes a poem and will attempt to match up a Spotify playlist with track names making up the poem.

To run, you need to have Python 3.1 installed. If you do not already have this, you can find instructions here

After everything is set up, simply run (feel free to choose a poem of your choosing :-):

python3.1 poem.py "STRANGER! if you, passing, meet me, and desire to speak to me, why should you not speak to me?"

As the program runs, you will the poem with matching tracks will be printed to your terminal. Some searches might take quite some time, so be patient :-)

Implementation notes

  • Poems are delimited into sentences where punctuation characters (e.g. ".", ",", "!") are found. Track matching is done on sentences, or part of.
  • Searches support UTF-8, but will might incorrectly delimit sentences containing non-ASCII whitespace characters. The search is case-insensitive.
  • The search algorithm will attempt to find the optimal match (fewest tracks per sentence). Currently, it will attempt the full search space, which for long sentences can mean quite a few searches (and thus long search times) but that it will (finally) find the optimal result.
  • Searches results will be cached according to the cache headers sent by Spotify. That means that repeated searches (possibly on the word level) will not go over the network and therefore be much faster.
  • The Spotify API is not optimal for this type of application. Some simple searches will simply not find a result, even though a match exists in the Spotify database. Such an example is the search for "And I" which will fail to locate a match using the API (at least among the 2000 first results). However, using the client will find several matches in the first search result (e.g. spotify:track:1Jp9n1uHB72CfK31j4mEPh).

spotify-poem's People

Contributors

protocol7 avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.