This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SpotifyWebApi = require('spotify-web-api-node'); | |
// Set the credentials when making the request | |
// For testing purposes, you can retrieve an access token from Spotify's Web Console here | |
// https://developer.spotify.com/console/delete-playlist-tracks | |
var spotifyApi = new SpotifyWebApi({ | |
accessToken: '' | |
}); | |
var tracks = [{ uri : "spotify:track:03EuhmMsEHVFI9ytainStU" }]; // track to remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SpotifyWebApi = require('spotify-web-api-node'); | |
// Set the credentials for the request | |
// For testing purposes, you can retrieve an access token from Spotify's Web Console here | |
// https://developer.spotify.com/console/delete-playlist-tracks | |
var spotifyApi = new SpotifyWebApi({ | |
accessToken: '' | |
}); | |
// Remove a track in the playlist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(["$api/models"], function(models) { | |
var getPosition = function(callback) { | |
models.player.load("position") | |
.done(function(player) { | |
callback(null, player.position); | |
}) | |
.fail(function(error) { | |
callback(error); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(["$api/models", "$api/library#Library"], function(models, Library) { | |
// Grab an embarrassing playlist that should be secret | |
var playlist = models.Playlist.fromURI("spotify:user:thelinmichael:playlist:3ktAYNcRHpazJ9qecm3ptn"); | |
// Get the library object for the current user | |
var library = Library.forCurrentUser(); | |
// Check if the playlist is published or not | |
playlist.load("published"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
require(['$api/models'], function(models) { | |
models.session.load("user").done(function(session) { | |
session.user.load("identifier").done(function(user) { | |
console.log("The identifier is " + user.identifier); | |
}).fail(function(error) { | |
console.log("An error occurred", error); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['$api/models'], function(models) { | |
models.session.load("user").done(function(session) { | |
session.user.load("identifier").done(function(user) { | |
console.log(user.identifier); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['$api/models', '$views/image#Image'], function(models, Image) { | |
var imageForTempPlaylist = function(playlist) { | |
var imageURI = "spotify:mosaic:", | |
promise = new models.Promise(); | |
playlist.tracks.snapshot(0, 4).done(function(snapshot) { | |
var trackImageURIs = snapshot._meta.map(function(trackMetadata) { | |
return trackMetadata.image; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['$api/relations#Relations'], function(Relations) { | |
var rels = Relations.forCurrentUser(); | |
rels.combinedSubscriptions.snapshot().done(function(snapshot) { | |
console.log('You have a total of', snapshot.length, 'follower(s).'); | |
console.log('Here are your followings:', snapshot.toArray()); | |
var items = snapshotToArray(snapshot); | |
console.log("And here are your followings again:", items); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript"> | |
require(["$api/models", "$api/activity#Feed"], function(models, Feed) { | |
// Retrieve feed for user | |
var user = models.User.fromURI("spotify:user:kristin.mv"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<script> | |
require(["$api/models#User", "$api/relations#Relations"], function(User, Relations) { | |
var username = "kristiankarl"; | |
var relations = Relations.forUser(User.fromURI("spotify:user:" + username)); | |
relations.load("combinedSubscriptions").done(function() { | |
relations.combinedSubscriptions.snapshot().done(function(snapshot) { |
NewerOlder