7digital Tomahawk Resolvers

Went to Amsterdam Music Hack Day and left with a working Tomahawk Resolver for 7digital previews, a spiked locker integration and some cool ideas on how to promote 7digital with Open Source

This will allow Tomahawk to use 7digital’s track search and listen to previews, in the future it will integrate buy buttons and help out Tomahawk to work with 7digital :-)

The locker integration is spiked using a local service which would be provided/maintained by either 7digital or a third party so it won’t be available immediately after the demo as there are feature, performance and security concerns.

What was used Link to heading

http://developer.7digital.net/ 7digital API with the demo musichackday API client key

https://github.com/tomahawk-player Tomahawk resolver examples and documentation

API locker service built in Ruby with Sinatra ( http://www.sinatrarb.com/ ) and the 7digital ruby API client gem ( http://rubygems.org/gems/7digital ). Also uses the JSON gem.

Also built some local stubbed API responses using Ruby Sinatra as the connection was slow/failed sometimes :-)

Don’t judge me on my JS..

https://github.com/goncalopereira/7digital-tomahawk-resolver working search with previews with musichackday key

https://github.com/goncalopereira/7digital-stubs stubs…

Service example code, this will authorise the user with a premium api account and get the locker, it is a slow implementation as locker search is not available and no caching was added but works.

require 'rubygems'
require 'sinatra'
require 'sevendigital'
require 'very_simple_cache.rb'
require 'json'

before do
	@api_client = Sevendigital::Client.new(:oauth_consumer_key =>x,
            :oauth_consumer_secret => 'x',
    		:lazy_load? => true,
    		:country => GB,
    		:cache => VerySimpleCache.new,
    		:verbose => "verbose")	  	   
end

post '/authorise' do
	content_type :json

	email = params["email"]
	password = params["password"]
	search = params["search"]

	user = @api_client.user.authenticate(email,password) #not good, should cache more
	locker = user.get_locker() #also caching missing

	valid_results = brute_force_search_on_string_compare(user, locker.locker_releases, search)

	valid_results.to_json
end