Browse Source

Removed UserAudioSummary class

master
Chris Shyi 7 years ago
parent
commit
90dbda4336
  1. 38
      spotifyvis/models.py
  2. 2
      spotifyvis/utils.py

38
spotifyvis/models.py

@ -4,6 +4,7 @@ from django.db import models
MAX_ID = 30
# Artist {{{ #
class Artist(models.Model):
class Meta:
verbose_name = "Artist"
@ -58,6 +59,7 @@ class Track(models.Model):
# AudioFeatures {{{ #
class AudioFeatures(models.Model):
class Meta:
@ -78,39 +80,3 @@ class AudioFeatures(models.Model):
return super(AudioFeatures, self).__str__()
# }}} AudioFeatures #
'''
class UserAudioSummary(models.Model):
"""
Stores the summary of a user's audio preferences
"""
class Meta:
verbose_name = "AudioFeatures"
verbose_name_plural = "AudioFeatures"
user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True,)
avg_acousticness = models.DecimalField(decimal_places=3, max_digits=3)
stdev_acousticness = models.DecimalField(decimal_places=3, max_digits=3)
avg_danceability = models.DecimalField(decimal_places=3, max_digits=3)
stdev_danceability = models.DecimalField(decimal_places=3, max_digits=3)
avg_energy = models.DecimalField(decimal_places=3, max_digits=3)
stdev_energy = models.DecimalField(decimal_places=3, max_digits=3)
avg_instrumentalness = models.DecimalField(decimal_places=3, max_digits=3)
stdev_instrumentalness = models.DecimalField(decimal_places=3, max_digits=3)
avg_loudness = models.DecimalField(decimal_places=3, max_digits=6)
stdev_loudness = models.DecimalField(decimal_places=3, max_digits=6)
avg_speechiness = models.DecimalField(decimal_places=3, max_digits=3)
stdev_speechiness = models.DecimalField(decimal_places=3, max_digits=3)
avg_tempo = models.DecimalField(decimal_places=3, max_digits=6)
stdev_tempo = models.DecimalField(decimal_places=3, max_digits=6)
avg_valence = models.DecimalField(decimal_places=3, max_digits=3)
stdev_valence = models.DecimalField(decimal_places=3, max_digits=3)
'''

2
spotifyvis/utils.py

@ -61,7 +61,7 @@ def parse_library(headers, tracks, library_stats, user):
if track_created:
save_audio_features(headers, track_dict['track']['id'], track_obj)
"""
TODO: Put this login in another function
TODO: Put this logic in another function
# Audio analysis could be empty if not present in Spotify database
if len(audio_features_dict) != 0:
# Track the number of audio analyses for calculating

Loading…
Cancel
Save