From cc2dc193aa850f7e866bce99f431a0a55fb53cfe Mon Sep 17 00:00:00 2001 From: Walter Date: Mon, 14 Sep 2015 16:04:17 -0400 Subject: [PATCH] Initial commit --- .meteor/.finished-upgraders | 8 +++++ .meteor/.gitignore | 1 + .meteor/.id | 7 ++++ .meteor/packages | 10 ++++++ .meteor/platforms | 2 ++ .meteor/release | 1 + .meteor/versions | 48 +++++++++++++++++++++++++ the_spotify_game_meteor.css | 1 + the_spotify_game_meteor.html | 18 ++++++++++ the_spotify_game_meteor.js | 68 ++++++++++++++++++++++++++++++++++++ 10 files changed, 164 insertions(+) create mode 100644 .meteor/.finished-upgraders create mode 100644 .meteor/.gitignore create mode 100644 .meteor/.id create mode 100644 .meteor/packages create mode 100644 .meteor/platforms create mode 100644 .meteor/release create mode 100644 .meteor/versions create mode 100644 the_spotify_game_meteor.css create mode 100644 the_spotify_game_meteor.html create mode 100644 the_spotify_game_meteor.js diff --git a/.meteor/.finished-upgraders b/.meteor/.finished-upgraders new file mode 100644 index 0000000..8a76103 --- /dev/null +++ b/.meteor/.finished-upgraders @@ -0,0 +1,8 @@ +# 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 +notices-for-facebook-graph-api-2 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..2f66e73 --- /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 + +15t0uap9rqet5v0vxpk diff --git a/.meteor/packages b/.meteor/packages new file mode 100644 index 0000000..13978d3 --- /dev/null +++ b/.meteor/packages @@ -0,0 +1,10 @@ +# Meteor packages used by this project, one per line. +# Check this file (and the other files in this directory) into your repository. +# +# 'meteor add' and 'meteor remove' will edit this file for you, +# but you can also edit it by hand. + +meteor-platform +autopublish +insecure +http 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..315c635 --- /dev/null +++ b/.meteor/release @@ -0,0 +1 @@ +METEOR@1.1.0.3 diff --git a/.meteor/versions b/.meteor/versions new file mode 100644 index 0000000..410e1d9 --- /dev/null +++ b/.meteor/versions @@ -0,0 +1,48 @@ +autopublish@1.0.3 +autoupdate@1.2.1 +base64@1.0.3 +binary-heap@1.0.3 +blaze@2.1.2 +blaze-tools@1.0.3 +boilerplate-generator@1.0.3 +callback-hook@1.0.3 +check@1.0.5 +ddp@1.1.0 +deps@1.0.7 +ejson@1.0.6 +fastclick@1.0.3 +geojson-utils@1.0.3 +html-tools@1.0.4 +htmljs@1.0.4 +http@1.1.0 +id-map@1.0.3 +insecure@1.0.3 +jquery@1.11.3_2 +json@1.0.3 +launch-screen@1.0.2 +livedata@1.0.13 +logging@1.0.7 +meteor@1.1.6 +meteor-platform@1.2.2 +minifiers@1.1.5 +minimongo@1.0.8 +mobile-status-bar@1.0.3 +mongo@1.1.0 +observe-sequence@1.0.6 +ordered-dict@1.0.3 +random@1.0.3 +reactive-dict@1.1.0 +reactive-var@1.0.5 +reload@1.1.3 +retry@1.0.3 +routepolicy@1.0.5 +session@1.1.0 +spacebars@1.0.6 +spacebars-compiler@1.0.6 +templating@1.1.1 +tracker@1.0.7 +ui@1.0.6 +underscore@1.0.3 +url@1.0.4 +webapp@1.2.0 +webapp-hashing@1.0.3 diff --git a/the_spotify_game_meteor.css b/the_spotify_game_meteor.css new file mode 100644 index 0000000..b6b4052 --- /dev/null +++ b/the_spotify_game_meteor.css @@ -0,0 +1 @@ +/* CSS declarations go here */ diff --git a/the_spotify_game_meteor.html b/the_spotify_game_meteor.html new file mode 100644 index 0000000..2ce6830 --- /dev/null +++ b/the_spotify_game_meteor.html @@ -0,0 +1,18 @@ + + The Spotify Game - Meteor Version + + + + + {{> hello}} + + + diff --git a/the_spotify_game_meteor.js b/the_spotify_game_meteor.js new file mode 100644 index 0000000..ea8a72f --- /dev/null +++ b/the_spotify_game_meteor.js @@ -0,0 +1,68 @@ +if (Meteor.isClient) { + + + Template.hello.helpers({ + }); + + Template.hello.events({ + 'click h2.start': function () { + // when h2 is clicked + inputArtist = $('input.inputArtist').val(); + HTTP.get('http://developer.echonest.com/api/v4/artist/profile?api_key=X2VQTSJP3SIFYYMVT&id=7digital-US:artist:' + inputArtist + '&format=json', + {}, + function (error, result) { + if (result.statusCode === 200) { + $('h2.currentArtist').empty().append(result.data.response.artist.name); + + } + }); + + HTTP.get('http://developer.echonest.com/api/v4/artist/similar?api_key=X2VQTSJP3SIFYYMVT&id=7digital-US:artist:' + inputArtist + '&format=json&results=8&start=0', + {}, + function (error, result) { + if (result.statusCode === 200) { + $('ul.artists').empty(); + //clear the list each click + for (var i = 0; i < result.data.response.artists.length; i++) { + //append artists to unordered list + $('ul.artists').append('
  • ' + result.data.response.artists[i].name + '
  • ') + } + } + } + ); + }, + 'click li': function (event) { + event.preventDefault(); + ///get the text of the clicked artist + nextArtist = $(event.target).text(); + + HTTP.get('http://developer.echonest.com/api/v4/artist/similar?api_key=X2VQTSJP3SIFYYMVT&id=7digital-US:artist:' + nextArtist + '&format=json&results=8&start=0', + {}, + function (error, result) { + if (result.statusCode === 200) { + $('ul.artists').empty(); + //clear the list each click + for (var i = 0; i < result.data.response.artists.length; i++) { + //append 8 artists to the unordered list + $('ul.artists').append('
  • ' + result.data.response.artists[i].name + '
  • ') + } + } + } + ); + $('h2.currentArtist').empty().append(nextArtist); + var currentArtist = $('h2.currentArtist').html(); + console.log('current artist is: ' + currentArtist); + var targetArtist = Math.floor((Math.random() * 100) + 1); + console.log('target artist is: ' + targetArtist); + if (currentArtist == targetArtist) { + alert("ZOMG YOU WIN!!!") + } + } + }); +} + +if (Meteor.isServer) { + Meteor.startup(function () { + // code to run on server at startup + }); +}