From 9ef5bb5c7346211cb7c2862a65ca5b2ec2606c56 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Wed, 26 Jun 2013 10:23:12 -0400 Subject: [PATCH] Added sndcrd.com integration --- git/hooks/post-commit | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/git/hooks/post-commit b/git/hooks/post-commit index 092a7b2..8372498 100755 --- a/git/hooks/post-commit +++ b/git/hooks/post-commit @@ -1,5 +1,15 @@ -#!/usr/bin/env ruby -file="~/.gitshots/#{Time.now.to_i}.jpg" -puts "Say Cheese!!~! ;)" -system "imagesnap -q #{file}" -exit 0 +#!/bin/bash + +# Grabs the project, kind of specific to github's format username/project +PROJECT=`git remote -v | head -1 | sed 's/.*git@.*:\(.*\).git.*/\1/'` + +# Get artist from Spotify +ARTIST=`osascript -e 'tell application "Spotify" to artist of current track'` + +# Get track from Spotify +TRACK=`osascript -e 'tell application "Spotify" to name of current track'` + +# Make it so! +curl "http://sndcrd.com/api?key=${SNDCRD_KEY}&project=${PROJECT}&artist=${ARTIST}&track=${TRACK}" > /dev/null 2>&1 + +imagesnap -q ~/.gitshots/`date +%s`.jpg &