Spaces:
Runtime error
Runtime error
Update app_utils.py
Browse files- app_utils.py +5 -4
app_utils.py
CHANGED
@@ -27,7 +27,7 @@ def setup_credentials():
|
|
27 |
|
28 |
os.environ['SPOTIPY_CLIENT_ID'] = client_info['client_id']
|
29 |
os.environ['SPOTIPY_CLIENT_SECRET'] = client_info['client_secret']
|
30 |
-
os.environ['SPOTIPY_REDIRECT_URI'] = '
|
31 |
return client_info
|
32 |
|
33 |
relevant_audio_features = ["danceability", "energy", "loudness", "mode", "valence", "tempo"]
|
@@ -43,7 +43,7 @@ def get_client():
|
|
43 |
def add_button(url, text):
|
44 |
st.write(f'''
|
45 |
<center>
|
46 |
-
<a
|
47 |
<button class='css-1cpxqw2'>
|
48 |
{text}
|
49 |
</button>
|
@@ -84,6 +84,8 @@ def extract_uris_from_links(links, url_type):
|
|
84 |
for url in urls:
|
85 |
if 'playlist' in url:
|
86 |
uri = url.split(f'{url_type}/')[-1].split('?')[0]
|
|
|
|
|
87 |
else:
|
88 |
uri = url.split('?')[0]
|
89 |
uris.append(uri)
|
@@ -145,10 +147,9 @@ def get_all_playlists_uris_from_users(sp, user_ids):
|
|
145 |
all_uris = []
|
146 |
all_names = []
|
147 |
for user_id in user_ids:
|
|
|
148 |
offset = 0
|
149 |
done = False
|
150 |
-
all_uris = []
|
151 |
-
playlist_names = []
|
152 |
while not done:
|
153 |
playlist_list = sp.user_playlists(user_id, offset=offset, limit=50)
|
154 |
these_names = [p['name'] for p in playlist_list['items']]
|
|
|
27 |
|
28 |
os.environ['SPOTIPY_CLIENT_ID'] = client_info['client_id']
|
29 |
os.environ['SPOTIPY_CLIENT_SECRET'] = client_info['client_secret']
|
30 |
+
os.environ['SPOTIPY_REDIRECT_URI'] = 'http://localhost:8501/'
|
31 |
return client_info
|
32 |
|
33 |
relevant_audio_features = ["danceability", "energy", "loudness", "mode", "valence", "tempo"]
|
|
|
43 |
def add_button(url, text):
|
44 |
st.write(f'''
|
45 |
<center>
|
46 |
+
<a style='color:black;' href="{url}">
|
47 |
<button class='css-1cpxqw2'>
|
48 |
{text}
|
49 |
</button>
|
|
|
84 |
for url in urls:
|
85 |
if 'playlist' in url:
|
86 |
uri = url.split(f'{url_type}/')[-1].split('?')[0]
|
87 |
+
elif 'user' in url:
|
88 |
+
uri = url.split(f'{url_type}/')[-1].split('?')[0]
|
89 |
else:
|
90 |
uri = url.split('?')[0]
|
91 |
uris.append(uri)
|
|
|
147 |
all_uris = []
|
148 |
all_names = []
|
149 |
for user_id in user_ids:
|
150 |
+
print(user_id)
|
151 |
offset = 0
|
152 |
done = False
|
|
|
|
|
153 |
while not done:
|
154 |
playlist_list = sp.user_playlists(user_id, offset=offset, limit=50)
|
155 |
these_names = [p['name'] for p in playlist_list['items']]
|