commit 8267f9563445b3c735f34d7792fe0143590f0810 Author: Dan Barber Date: Fri Oct 31 17:29:18 2014 +0000 First commit. diff --git a/.meteor/.finished-upgraders b/.meteor/.finished-upgraders new file mode 100644 index 0000000..68df3d8 --- /dev/null +++ b/.meteor/.finished-upgraders @@ -0,0 +1,7 @@ +# This file contains information which helps Meteor properly upgrade your +# app when you run 'meteor update'. You should check it into version control +# with your project. + +notices-for-0.9.0 +notices-for-0.9.1 +0.9.4-platform-file diff --git a/.meteor/.gitignore b/.meteor/.gitignore new file mode 100644 index 0000000..4083037 --- /dev/null +++ b/.meteor/.gitignore @@ -0,0 +1 @@ +local diff --git a/.meteor/.id b/.meteor/.id new file mode 100644 index 0000000..ecbecb8 --- /dev/null +++ b/.meteor/.id @@ -0,0 +1,7 @@ +# This file contains a token that is unique to your project. +# Check it into your repository along with the rest of this directory. +# It can be used for purposes such as: +# - ensuring you don't accidentally deploy one app on top of another +# - providing package authors with aggregated statistics + +dmk8fsfa8vh91m4mf9x diff --git a/.meteor/cordova-plugins b/.meteor/cordova-plugins new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.meteor/cordova-plugins @@ -0,0 +1 @@ + diff --git a/.meteor/packages b/.meteor/packages new file mode 100644 index 0000000..6ac6095 --- /dev/null +++ b/.meteor/packages @@ -0,0 +1,11 @@ +# Meteor packages used by this project, one per line. +# +# 'meteor add' and 'meteor remove' will edit this file for you, +# but you can also edit it by hand. + +meteor-platform +autopublish +insecure +http +underscore + diff --git a/.meteor/platforms b/.meteor/platforms new file mode 100644 index 0000000..efeba1b --- /dev/null +++ b/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/.meteor/release b/.meteor/release new file mode 100644 index 0000000..87bf495 --- /dev/null +++ b/.meteor/release @@ -0,0 +1 @@ +METEOR@1.0 diff --git a/.meteor/versions b/.meteor/versions new file mode 100644 index 0000000..235a83e --- /dev/null +++ b/.meteor/versions @@ -0,0 +1,52 @@ +application-configuration@1.0.3 +autopublish@1.0.1 +autoupdate@1.1.3 +base64@1.0.1 +binary-heap@1.0.1 +blaze-tools@1.0.1 +blaze@2.0.3 +boilerplate-generator@1.0.1 +callback-hook@1.0.1 +check@1.0.2 +ctl-helper@1.0.4 +ctl@1.0.2 +ddp@1.0.11 +deps@1.0.5 +ejson@1.0.4 +fastclick@1.0.1 +follower-livedata@1.0.2 +geojson-utils@1.0.1 +html-tools@1.0.2 +htmljs@1.0.2 +http@1.0.8 +id-map@1.0.1 +insecure@1.0.1 +jquery@1.0.1 +json@1.0.1 +launch-screen@1.0.0 +livedata@1.0.11 +logging@1.0.5 +meteor-platform@1.2.0 +meteor@1.1.3 +minifiers@1.1.2 +minimongo@1.0.5 +mobile-status-bar@1.0.1 +mongo@1.0.8 +observe-sequence@1.0.3 +ordered-dict@1.0.1 +random@1.0.1 +reactive-dict@1.0.4 +reactive-var@1.0.3 +reload@1.1.1 +retry@1.0.1 +routepolicy@1.0.2 +session@1.0.4 +spacebars-compiler@1.0.3 +spacebars@1.0.3 +templating@1.0.9 +tracker@1.0.3 +ui@1.0.4 +underscore@1.0.1 +url@1.0.2 +webapp-hashing@1.0.1 +webapp@1.1.4 diff --git a/spotify-client.css b/spotify-client.css new file mode 100644 index 0000000..c2487d8 --- /dev/null +++ b/spotify-client.css @@ -0,0 +1,30 @@ +/* CSS declarations go here */ +*, *:before, *:after { + box-sizing: border-box; +} + +body { + font-family: "Helvetica Neue", sans-serif; +} + +ul.songs { + list-style: none; + padding-left: 0; +} + + ul.songs li:after { + content: ""; + display: block; + clear: left; + margin-bottom: 0.5em; + } + + ul.songs .album { + color: #666; + font-style: italic; + } + +img.cover { + float: left; + margin-right: 1em; +} diff --git a/spotify-client.html b/spotify-client.html new file mode 100644 index 0000000..cf4bc86 --- /dev/null +++ b/spotify-client.html @@ -0,0 +1,23 @@ + + Spotify Client + + + + + + + + + diff --git a/spotify-client.js b/spotify-client.js new file mode 100644 index 0000000..25fa3ad --- /dev/null +++ b/spotify-client.js @@ -0,0 +1,41 @@ +if (Meteor.isClient) { + Template.body.helpers({ + songs: function () { + return Session.get('songs') + } + }) + + Template.body.events({ + "submit .search": function (event) { + event.preventDefault() + + q = event.target.q.value + + if (q) { + HTTP.call('get', 'https://api.spotify.com/v1/search', { + params: { type: 'track', market: 'GB', q: q } + }, function (error, result) { + if (!error) { + tracks = [] + + items = JSON.parse(result.content).tracks.items + + items.forEach(function (item) { + tracks.push({ + artist: item.artists.map(function (artist) { + return artist.name + }).join(', '), + album: item.album.name, + title: item.name, + image: item.album.images[2].url + }) + console.log(item) + }) + + Session.set('songs', tracks) + } + }) + } + } + }) +}