Use a list to store users' tracks and likes

This commit is contained in:
Thomas Wade 2018-09-20 00:57:33 +09:30
parent aff01870b5
commit cde49030dc

View File

@ -48,6 +48,9 @@ class User:
following_count = None following_count = None
follower_count = None follower_count = None
tracks = []
likes = []
class Track: class Track:
title = None title = None
artist = None artist = None
@ -176,7 +179,8 @@ def Get_Tracks_Info(url, limit = 100):
print(' ' + track.artist + ' - ' + track.title) print(' ' + track.artist + ' - ' + track.title)
return tracks # Strip off keys and return a track list
return tracks.values()
user_dict = {} user_dict = {}
users_to_process = ['thomotron', 'lacheque', 'slynk', 'bossfightswe'] users_to_process = ['thomotron', 'lacheque', 'slynk', 'bossfightswe']
@ -215,5 +219,5 @@ for _, user in user_dict.items():
print(' Following ' + str(user.following_count)) print(' Following ' + str(user.following_count))
print(' Followed by ' + str(user.follower_count)) print(' Followed by ' + str(user.follower_count))
print(' Tracks:') print(' Tracks:')
for _, track in user.tracks.items(): for track in user.tracks:
print(' ' + track.title) print(' ' + str(track.title))