Browse Source

Removed UserAudioSummary class

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

40
spotifyvis/models.py

@ -4,6 +4,7 @@ from django.db import models
MAX_ID = 30 MAX_ID = 30
# Artist {{{ # # Artist {{{ #
class Artist(models.Model): class Artist(models.Model):
class Meta: class Meta:
verbose_name = "Artist" verbose_name = "Artist"
@ -58,6 +59,7 @@ class Track(models.Model):
# AudioFeatures {{{ # # AudioFeatures {{{ #
class AudioFeatures(models.Model): class AudioFeatures(models.Model):
class Meta: class Meta:
@ -77,40 +79,4 @@ class AudioFeatures(models.Model):
def __str__(self): def __str__(self):
return super(AudioFeatures, self).__str__() 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)
'''
# }}} AudioFeatures #

2
spotifyvis/utils.py

@ -61,7 +61,7 @@ def parse_library(headers, tracks, library_stats, user):
if track_created: if track_created:
save_audio_features(headers, track_dict['track']['id'], track_obj) 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 # Audio analysis could be empty if not present in Spotify database
if len(audio_features_dict) != 0: if len(audio_features_dict) != 0:
# Track the number of audio analyses for calculating # Track the number of audio analyses for calculating

Loading…
Cancel
Save