kmaurinjones commited on
Commit
d050fe6
1 Parent(s): e665916

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -7,6 +7,12 @@ st.title("SongScope")
7
  st.write("Welcome to SongScope. This is a web app that lets you download lyrics and metadata of your favourite artist.\n")
8
  st.write("Enter an artist name, and you can even select up to 5 songs to retrieve their data. If you don't specify any songs,\ndata on all songs by the artist will be retrieved.")
9
 
 
 
 
 
 
 
10
  # user-provided data
11
  artist_name = st.text_input("Enter artist name here")
12
  song_1 = st.text_input("Enter 1st song title here")
@@ -19,6 +25,11 @@ song_5 = st.text_input("Enter 5th song title here")
19
  #################################################################
20
 
21
  # PUT GET DATA FUNCTION HERE
 
 
 
 
 
22
 
23
  #################################################################
24
 
@@ -26,9 +37,9 @@ song_5 = st.text_input("Enter 5th song title here")
26
  csv_dl_button = st.download_button('Download Data', DATA_TO_CSV, 'text/csv')
27
  # st.download_button('Download Data', DATA_TO_CSV) # Defaults to 'text/plain'
28
 
29
- with open(f'{artist_name.lower()}_data.csv') as f:
30
- st.download_button('Download CSV', f) # Defaults to 'text/plain'
31
- st.write("Your data should now be downloading.")
32
 
33
  # fun facts
34
  fun_fax = []
@@ -38,6 +49,9 @@ with open("fun_fax.txt", "r", encoding = "utf-8") as f:
38
  fun_fax.append(word)
39
  f.close() # closes connection to file
40
 
 
 
 
41
  st.write(fun_fax[random.randint(0, len(fun_fax) - 1)])
42
 
43
  # "thank you" blurb
 
7
  st.write("Welcome to SongScope. This is a web app that lets you download lyrics and metadata of your favourite artist.\n")
8
  st.write("Enter an artist name, and you can even select up to 5 songs to retrieve their data. If you don't specify any songs,\ndata on all songs by the artist will be retrieved.")
9
 
10
+ # delay times
11
+ delay_min = int(st.text_input("Minimum delay per iteration"))
12
+ delay_max = int(st.text_input("Maximum delay per iteration"))
13
+ # delay_min = 15
14
+ # delay_max = 30
15
+
16
  # user-provided data
17
  artist_name = st.text_input("Enter artist name here")
18
  song_1 = st.text_input("Enter 1st song title here")
 
25
  #################################################################
26
 
27
  # PUT GET DATA FUNCTION HERE
28
+ artist_df = get_all_data(artist_name = artist_name,
29
+ song_titles = song_1 + song_2 + song_3 + song_4 + song_5,
30
+ delay = (delay_min, delay_max), # random float value between (delay_min, delay_max) seconds
31
+ print_progress = True)
32
+ # artist_df.to_csv(f"{artist_name.lower()}_data.csv")
33
 
34
  #################################################################
35
 
 
37
  csv_dl_button = st.download_button('Download Data', DATA_TO_CSV, 'text/csv')
38
  # st.download_button('Download Data', DATA_TO_CSV) # Defaults to 'text/plain'
39
 
40
+ # with open(f'{artist_name.lower()}_data.csv') as f:
41
+ # st.download_button('Download CSV', f) # Defaults to 'text/plain'
42
+ # st.write("Your data should now be downloading.")
43
 
44
  # fun facts
45
  fun_fax = []
 
49
  fun_fax.append(word)
50
  f.close() # closes connection to file
51
 
52
+ if csv_dl_button:
53
+ st.write("Your data should be downloaded. If not, please reload the page and try again.")
54
+
55
  st.write(fun_fax[random.randint(0, len(fun_fax) - 1)])
56
 
57
  # "thank you" blurb