Browse Source

Made minor fixes to docstrings

master
Chris Shyi 6 years ago
parent
commit
6665532fea
  1. 9
      api/utils.py
  2. 3
      api/views.py

9
api/utils.py

@ -135,11 +135,11 @@ def get_audio_features(headers, track_objs):
# process_artist_genre {{{ # # process_artist_genre {{{ #
def process_artist_genre(genre_name, artist_obj): def process_artist_genre(genre_name, artist_obj):
"""Increase count for correspoding Genre object to genre_name and add that
Genre to artist_obj.
"""Increase count for corresponding Genre object to genre_name and associate that
Genre object with artist_obj.
:genre_name: Name of genre. :genre_name: Name of genre.
:artist_obj: Artist object to add Genre object to.
:artist_obj: Artist object to associate Genre object with
:returns: None :returns: None
""" """
@ -167,10 +167,9 @@ def add_artist_genres(headers, artist_objs):
""" """
artist_ids = str.join(",", [artist_obj.id for artist_obj in artist_objs]) artist_ids = str.join(",", [artist_obj.id for artist_obj in artist_objs])
params = {'ids': artist_ids}
artists_response = requests.get('https://api.spotify.com/v1/artists/', artists_response = requests.get('https://api.spotify.com/v1/artists/',
headers=headers, headers=headers,
params=params,
params={'ids': artist_ids},
).json()['artists'] ).json()['artists']
for i in range(len(artist_objs)): for i in range(len(artist_objs)):
if len(artists_response[i]['genres']) == 0: if len(artists_response[i]['genres']) == 0:

3
api/views.py

@ -56,6 +56,7 @@ def parse_library(request, user_secret):
if console_logging: if console_logging:
tracks_processed = 0 tracks_processed = 0
tracks_processed = 0
for track_dict in saved_tracks_response: for track_dict in saved_tracks_response:
# add artists {{{ # # add artists {{{ #
@ -103,7 +104,7 @@ def parse_library(request, user_secret):
offset += USER_TRACKS_LIMIT offset += USER_TRACKS_LIMIT
# clean-up {{{ # # clean-up {{{ #
# update remaining artists without genres and songs without features if # update remaining artists without genres and songs without features if
# there are any # there are any
if len(artist_genre_queue) > 0: if len(artist_genre_queue) > 0:

Loading…
Cancel
Save