Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit c758870514a7688f8b230e79d5ca79bcd3637aad @stran12 committed Jun 3, 2012
Showing with 224 additions and 0 deletions.
  1. 0 README
  2. +63 −0 index.html
  3. +63 −0 index.html~
  4. +18 −0 manifest.json
  5. +20 −0 manifest.json~
  6. +5 −0 tutorial.css
  7. +55 −0 tutorial.js
0 README
No changes.
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ @import url('sp://import/css/api.css');
+ @import url('sp://import/css/player.css');
+ @import url('sp://import/css/eve.css');
+ </style>
+ <title>My First App</title>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+
+</head>
+<body>
+
+<h1 id="header">Hello, worlddd!</h1>
+
+<div id="player"></div>
+<div id="search"></div>
+
+<script type="text/javascript">
+
+ console.log("being");
+ var sp = getSpotifyApi(1);
+ var models = sp.require('sp://import/scripts/api/models');
+ var views = sp.require('sp://import/scripts/api/views');
+
+ var tempPlaylist = new models.Playlist();
+ var playlist = new views.List(tempPlaylist);
+
+ var track = models.Track.fromURI("spotify:track:3gT6bVIAIwWmZZEHCP58xs");
+ tempPlaylist.add(track);
+ tempPlaylist.add(models.Track.fromURI("spotify:track:3enFTlwkCRF5HUM8xX6FKB"));
+
+
+
+
+ playerHTML = document.getElementById('player').appendChild(playlist.node);
+
+ var search = new models.Search('genre:"Indie Rock"');
+ search.localResults = models.LOCALSEARCHRESULTS.APPEND;
+ var searchHTML = document.getElementById('search');
+
+ search.observe(models.EVENT.CHANGE, function() {
+ var results = search.tracks;
+ for(i=0;i<results.length;i++){
+ tempPlaylist.add(results[i]);
+
+ }
+ });
+
+ search.appendNext();
+
+ playerHTML = document.getElementById('player').appendChild(playlist.node);
+
+
+ </script>
+
+<h3>what now?</h3>
+
+
+
+</body>
+</html>
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ @import url('sp://import/css/api.css');
+ @import url('sp://import/css/player.css');
+ @import url('sp://import/css/eve.css');
+ </style>
+ <title>My First App</title>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+
+</head>
+<body>
+
+<h1 id="header">Hello, worlddd!</h1>
+
+<div id="player"></div>
+<div id="search"></div>
+
+<script type="text/javascript">
+
+ console.log("being");
+ var sp = getSpotifyApi(1);
+ var models = sp.require('sp://import/scripts/api/models');
+ var views = sp.require('sp://import/scripts/api/views');
+
+ var tempPlaylist = new models.Playlist();
+ var playlist = new views.List(tempPlaylist);
+
+ var track = models.Track.fromURI("spotify:track:3gT6bVIAIwWmZZEHCP58xs");
+ tempPlaylist.add(track);
+ tempPlaylist.add(models.Track.fromURI("spotify:track:3enFTlwkCRF5HUM8xX6FKB"));
+
+
+
+
+ playerHTML = document.getElementById('player').appendChild(playlist.node);
+
+ var search = new models.Search("genre:'Indie Rock'");
+ search.localResults = models.LOCALSEARCHRESULTS.APPEND;
+ var searchHTML = document.getElementById('search');
+
+ search.observe(models.EVENT.CHANGE, function() {
+ var results = search.tracks;
+ for(i=0;i<results.length;i++){
+ tempPlaylist.add(results[i]);
+
+ }
+ });
+
+ search.appendNext();
+
+ playerHTML = document.getElementById('player').appendChild(playlist.node);
+
+
+ </script>
+
+<h3>what now?</h3>
+
+
+
+</body>
+</html>
@@ -0,0 +1,18 @@
+{
+ "BundleType": "Application",
+ "AppIcon": {
+ "36x18": "tutorial.png"
+ },
+ "AppName": "My Application",
+ "AppDescription": "Music discovery spotify app that plays music from bands that are coming to your town.",
+ "SupportedLanguages": [
+ "en"
+ ],
+ "BundleIdentifier": "townsound",
+ "BundleVersion": "0",
+ "RequiredInterface": 1,
+ "VendorIdentifier": "stephen.v.tran@gmail.com",
+ "RequiredPermissions": [
+ "https://ajax.googleapis.com"
+ ]
+}
@@ -0,0 +1,20 @@
+{
+ "BundleType": "Application",
+ "AppIcon": {
+ "36x18": "tutorial.png"
+ },
+ "AppName": "My Application",
+ "AppDescription": "Music discovery spotify app that plays music from bands that are coming to your town.",
+ "SupportedLanguages": [
+ "en"
+ ],
+ "BundleIdentifier": "townsound",
+ "BundleVersion": "0",
+ "RequiredInterface": 1,
+ "VendorIdentifier": "stephen.v.tran@gmail.com",
+ "RequiredPermissions": [
+ "http://pagead2.googlesyndication.com/pagead/show_ads.js",
+ "http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-6462898257742902&amp;output=html&amp;h=90&amp;slotname=7420673030&amp;w=728&amp;lmt=1336658118&amp;flash=11.1.102&amp;url=sp%3A%2F%2Ftutorial%2Findex.html&amp;dt=1336632918578&amp;bpp=6&amp;shv=r20120502&amp;jsv=r20110914&amp;correlator=1336632918588&amp;frm=20&amp;adk=388660954&amp;ga_vid=378622689.1336632919&amp;ga_sid=1336632919&amp;ga_hid=484053984&amp;ga_fc=0&amp;u_tz=-420&amp;u_his=1&amp;u_java=0&amp;u_h=1080&amp;u_w=1920&amp;u_ah=1040&amp;u_aw=1920&amp;u_cd=32&amp;u_nplug=20&amp;u_nmime=104&amp;dff=times&amp;dfs=16&amp;adx=8&amp;ady=87&amp;biw=1685&amp;bih=912&amp;oid=3&amp;fu=0&amp;ifi=1&amp;dtd=13&amp;xpc=WZVnaFXCEc&amp;p=sp%3A//tutorial",
+ "https://ajax.googleapis.com"
+ ]
+}
@@ -0,0 +1,5 @@
+h1 {
+ text-align: center;
+ font-size: 24px;
+ padding: 20px;
+}
@@ -0,0 +1,55 @@
+var sp = getSpotifyApi(1);
+var models = sp.require('sp://import/scripts/api/models');
+var player = models.player;
+
+exports.init = init;
+
+function init() {
+
+ updatePageWithTrackDetails();
+
+ player.observe(models.EVENT.CHANGE, function (e) {
+
+ // Only update the page if the track changed
+ if (e.data.curtrack == true) {
+ updatePageWithTrackDetails();
+ }
+ });
+
+ searchLastFMForEvents("stockholm");
+}
+
+function updatePageWithTrackDetails() {
+
+ var header = document.getElementById("header");
+
+ // This will be null if nothing is playing.
+ var playerTrackInfo = player.track;
+
+ if (playerTrackInfo == null) {
+ header.innerText = "Nothing playing!";
+ } else {
+ var track = playerTrackInfo.data;
+ header.innerHTML = track.name + " on the album " + track.album.name + " by " + track.album.artist.name + ".";
+ }
+}
+
+function searchLastFMForEvents(city) {
+
+ var req = new XMLHttpRequest();
+ req.open("GET", "http://ws.audioscrobbler.com/2.0/?method=geo.getevents&location=" + city + "&api_key=YOUR_KEY_HERE", true);
+
+ req.onreadystatechange = function() {
+
+ console.log(req.status);
+
+ if (req.readyState == 4) {
+ if (req.status == 200) {
+ console.log("Search complete!");
+ console.log(req.responseText);
+ }
+ }
+ };
+
+ req.send();
+}

0 comments on commit c758870

Please sign in to comment.