Browse Source
Add top genre to Track object
Add top genre to Track object
- merge from chris/audio_features branch - fixed crashing when new artist doesn't have genre - get genre/artist data using user secret - removed punctuation from user secretmaster
Kevin Mok
7 years ago
8 changed files with 150 additions and 83 deletions
-
1.gitignore
-
4spotifyvis/models.py
-
28spotifyvis/static/spotifyvis/scripts/user_data.js
-
21spotifyvis/templates/spotifyvis/test_db.html
-
11spotifyvis/templates/spotifyvis/user_data.html
-
3spotifyvis/urls.py
-
62spotifyvis/utils.py
-
103spotifyvis/views.py
@ -0,0 +1,28 @@ |
|||
/** |
|||
* Retrieves data for a specific audio feature for a certain user |
|||
* @param audioFeature: the audio feature for which data will be retrieved |
|||
* @param clientSecret: the client secret, needed for security |
|||
*/ |
|||
function getAudioFeatureData(audioFeature, userSecret) { |
|||
let httpRequest = new XMLHttpRequest(); |
|||
/* |
|||
* Handler for the response |
|||
*/ |
|||
httpRequest.onreadystatechange = function() { |
|||
if (httpRequest.readyState === XMLHttpRequest.DONE) { |
|||
if (httpRequest.status === 200) { |
|||
let responseData = JSON.parse(httpRequest.responseText); |
|||
// TODO: The data points need to be plotted instead
|
|||
for (let data of responseData.data_points) { |
|||
console.log(data); |
|||
} |
|||
} else { |
|||
alert("There was a problem with the login request, please try again!"); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
let queryString = `/audio_features/${audioFeature}/${userSecret}`; |
|||
httpRequest.open('GET', queryString, true); |
|||
httpRequest.send(); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue