Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Build custom music playlists using facial recognition. Powered by the Hunch API.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 face_client
Octocat-spinner-32 pyechonest
Octocat-spinner-32 simplejson
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 __init__.py
Octocat-spinner-32 echonest.py
Octocat-spinner-32 visage.py
README.md

Automatic DJ

AutomaticDJ

Automatic music selection system for people who love great music (even if they don't know it yet). Uses facial recognition and the Hunch API to build a custom playlist based on the tastes of the people at the party.

Take a picture of one of your friends at a party. The Face.com API maps the face to a Facebook ID. Given this ID, the Hunch API provides music (or movie, or picture, or food) recommendations (and it's scary accurate). Tailor your entire party to the taste of your guests. Play their theme song when they enter the room. Or discover new music recommendations that they would like. Note that you don't need to have music likes on your Facebook page, the Hunch API can infer taste based solely on the social graph.

The current version uses Spotify to play the songs (controlled via AppleScript), but once the playlist is generated you can use any music player to play the track. There is also minimal support in the code for playing songs through the GrooveShark API.

Other libraries used include:

Getting started

  1. In visage.py

    • Edit the section titled "edit me!" with youe Face.com API key and secret, Facebook session key, Facebook ID, and Hunch auth token
  2. Train your friends' faces

    • import visage
    • visage.train("http://www.facebook.com/gleitz")
  3. Take a photo, get the Facebook id of the user, get music recommendations from Hunch, and play the song using Spotify

    • visage.musicify()

Notes and gotchas

  • If you just want to test the photo -> FB id functionality, try calling visage.recognize()

  • Getting a FB session is a bit of a pain. Here's what I did:

    1. Create a Facebook App (make sure the Canvas Type is IFrame and Application Type is HTML5
    2. Set your site URL to http://gleitzman.com/faces/ (or a link of your choosing, I am just using this as a dummy)
    3. Go to this link, inserting your client_id where I have 'XXX' https://graph.facebook.com/oauth/authorize?client_id=XXX&redirect_uri=http%3A//gleitzman.com/faces/&scope=offline_access,email,user_birthday,user_about_me,user_education_history,user_interests,user_likes,user_location,user_religion_politics,user_website,user_work_history,user_checkins,friends_about_me,friends_likes,friends_birthday,friends_education_history,friends_checkins,user_photo_video_tags,user_photos,friends_photo_video_tags,friends_photos,friends_birthday,friends_location,friends_work_history,friends_education_history,friends_activities,friends_hometown,friends_interests,friends_location,friends_likes
    4. Note the code that is returned in the URL
    5. Exchange the code, your Facebook client id, and Facebook client secret for an infinite session https://graph.facebook.com/oauth/access_token?client_id=XXX&client_secret=XXX&code=XXX&redirect_uri=http%3A//gleitzman.com/faces/
Something went wrong with that request. Please try again.