1
0
mirror of https://github.com/danbee/spotify-client synced 2025-03-04 08:59:12 +00:00

First commit.

This commit is contained in:
Dan Barber 2014-10-31 17:29:18 +00:00
commit 8267f95634
11 changed files with 176 additions and 0 deletions

View File

@ -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

1
.meteor/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local

7
.meteor/.id Normal file
View File

@ -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

1
.meteor/cordova-plugins Normal file
View File

@ -0,0 +1 @@

11
.meteor/packages Normal file
View File

@ -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

2
.meteor/platforms Normal file
View File

@ -0,0 +1,2 @@
server
browser

1
.meteor/release Normal file
View File

@ -0,0 +1 @@
METEOR@1.0

52
.meteor/versions Normal file
View File

@ -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

30
spotify-client.css Normal file
View File

@ -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;
}

23
spotify-client.html Normal file
View File

@ -0,0 +1,23 @@
<head>
<title>Spotify Client</title>
</head>
<body>
<form class="search">
<input name="q" type="search">
</form>
<ul class="songs">
{{#each songs}}
{{> song}}
{{/each}}
</ul>
</body>
<template name="song">
<li>
<img class="cover" src="{{image}}">
<div class="track"><b>{{artist}}</b>: {{title}}</div>
<div class="album">{{album}}</div>
</li>
</template>

41
spotify-client.js Normal file
View File

@ -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)
}
})
}
}
})
}